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 4551612
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:39:38+00:00 2026-05-21T16:39:38+00:00

I have three tables. Tab_1,Tab_2 and Tab_3. Here Tab_2 and Tab_3 are depend on

  • 0

I have three tables. Tab_1,Tab_2 and Tab_3. Here Tab_2 and Tab_3 are depend on Tab_1.
Means PK_t1 of Tab_1 is FK(Foreign Key) in the remaining tables.

Now I come to know that I have to update the PK_t1(Primary Key) column. If I update primary key column then FK column of the child tables(Tabl_2 and Tab_3) also should update.

---------------------------------------------
Example

Tab_1
ID(PK)| Cal2 |
---------------|
101    | abc   |
102    | acw   |
103    | bhj   |


Tab_2
----------------
Address| Cal2(FK_ID)
----------------
ljjkkl | 103
ghhj   | 101
dfgjdl | 101

Tab_3
----------------
Cal1   | ID(FK_ID)
----------------
n233b  | 101
g55hhj | 103
d867hh | 102

And now If I wan to update the tablee Tab_1 as

Tab_1
ID(PK)| Cal2 |
---------------|
951    | abc   |
952    | acw   |
953    | bhj   |

Will this(updation) cause to the child tables also.

Is it possible? Or what necessary actions I should take to achieve this.

Thanks in advance…!

  • 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-21T16:39:39+00:00Added an answer on May 21, 2026 at 4:39 pm

    This is one of the reasons for Cascade Update on foreign key relationships. With that, you would be able to update the PK in Table1 and it would automatically propagate to its child tables. That constraint would look something like:

    Alter Table Table2
        Add Foreign Key ( FK_ID )
            References Table1( Id )
            On Update Cascade
    

    Without Cascade Update enabled, you have two choices:

    1. Disable all foreign key constraints, update the PK in Table1, update the child tables and then recreate the foreign key constraints.
    2. Add a new value into Table1 with the ID you want and run an Update on the child tables. For example, if you wanted to change the PK value 101 to 951:
    
        Begin Transaction
    
        Insert Table1( Id, Cal2 )
        Values( 951, 'Foo' )
    
        Update Table2
        Set FK_ID = 951
        Where FK_ID = 101
    
        Update Table3
        Set FK_ID = 951
        Where FK_ID = 101
    
        ...
    
        Delete Table1 Where Id = 101
    
        Commit Transaction

    The catch with this second approach is that none of the new ID values can collide with existing PK values.

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

Sidebar

Related Questions

I have three tables A: A.pID primary key, A.Name nvarchar(250) B: B.pID primary key,
I have three tables: page, attachment, page-attachment I have data like this: page ID
I have three tables tag , page , pagetag With the data below page
I have three tables in the many-to-many format. I.e, table A, B, and AB
I have three tables like that: Articles IdArticle Title Content Tags IdTag TagName ContentTag
I have three tables. This query will write down the right answer (x-lines for
I have three tables in my DB (actually a few more than that) these
I have three tables: videos, videos_categories, and categories. The tables look like this: videos:
I have three tables of information where the business_id is the common thread. I
I have three tables being used for this problem: songs, blacklist, and whitelist. 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.