Tag Info

New answers tagged

3

Define all the foreign keys as CASCADE UPDATE If you have not done this, then you'll have to Create a new row with new primary key Update all child tables Remove old row .. in a transaction of course and watching out for other constraints that could fail


3

If you have defined the Foreign Key constraints as ON UPDATE CASCADE then the Primary Key value that was changed should cascade down to all the Foreign Keys with that constraint. If you do not have the ON UPDATE CASCADE constraint, then you will need create scripts to complete the update. EDIT: Since you do not have the ON UPDATE CASCADE constraint, but ...


4

You sure can. ON UPDATE CASCADE is what you are looking for. Here's a small how-to: http://sqlandme.com/2011/08/08/sql-server-how-to-cascade-updates-and-deletes-to-related-tables/ Basically, when you modify the PK, the cascade will go out and update all the FKs that reference it. This can be done in your CREATE statement, same as if you were doing a ...



Top 50 recent answers are included