cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Foreign Keys

Pinki Meggi
Frequent Advisor

Updating Foreign Keys

Hi,

I need to update a PRIMARY KEY but there is FOREIGN KEYS in other tables. I dont know how to do this.

Can i disable the FOREIGN KEYS Constraints ? Or there are another solution?

Please need help.


Thanks in advance

Best Regards

Pinki
2 REPLIES
Peter Godron
Honored Contributor

Re: Updating Foreign Keys

Pinki,
Primary keys should not be updated !

The totally correct way would be to remove the record with the primary key and the connected records. Then re-create the record with new key and the connected records.

The not so correct way is to temporarily remove the foreign key constraint, change the record and then re-enable constraint.

Please check your database referential consistency afterwards !
Oviwan
Honored Contributor

Re: Updating Foreign Keys