Operating System - HP-UX
1753776 Members
7431 Online
108799 Solutions
New Discussion юеВ

Re: 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 2
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