Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 800319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:16:30+00:00 2026-05-14T23:16:30+00:00

I have two tables, Customer and CustomerPhone. Single record in Customer can have multiple

  • 0

I have two tables, Customer and CustomerPhone.

Single record in Customer can have multiple CustomerPhone records. As you see in the image below, Phone and Fax resides in CustomerPhone table whereas the rest of the fields resides in Customer table. If user want to edits a customer record, obviously i will have to update the record in Customer table and at least two records from CustomerPhone (Phone and Fax).

http://img714.imageshack.us/img714/9417/snapshotapp.jpg http://img714.imageshack.us/img714/9417/snapshotapp.jpg

I could write two update statements, one Update customerPhone and the second update Customer table. Is there a better solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:16:30+00:00Added an answer on May 14, 2026 at 11:16 pm

    The risk in a case like this is that the one update succeeds but the other fails for some reason (a network cable is unplugged, power failure, whatever) which would leave your data in the database incorrect.

    You can overcome this in 2 ways.

    1. Do the 2 separate updates, but
      enclose them in a single transaction
    2. Implement a customer update
      stored procedure which updates both
      tables for you, in either an
      implicit or explicit transaction.

    There is no way in SQL to update multiple tables in a single statement, but you can of course have multiple statements in the same command.

    The second option above may be problematic for you as you can have many phone numbers for a customer and it would be limiting, so I would suggest running the separate updates, but do it in a transaction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, Customer and CustomerPhone. Customer usually has multiple phone numbers, so
I have two tables Group and Customer and of course two entities Group and
I have two tables Customer (idCustomer, ecc.. ecc..) Comment (idCustomer, idComment, ecc.. ecc..) obviously
I have the following two tables: Customer { int Id int Name } Bills
I have two basic SQL Server tables: Customer (ID [pk], AddressLine1, AddressLine2, AddressCity, AddressDistrict,
I have two tables, one called customer and one called customer_attributes . The idea
Suppose I have two tables, Customer and Vendor. I want to have a common
I have two tables, jos_eimcart_customers_addresses and jos_eimcart_customers. I want to pull all records from
I have two tables, Customer and CustomerConfiguration that should have a one-to-one mapping. What
Ok, so I have two tables in MySQL. One table holds customer information, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.