SQL update a table with a foreign key

Posted by drousseau on Stack Overflow See other posts from Stack Overflow or by drousseau
Published on 2010-04-19T19:25:59Z Indexed on 2010/04/19 19:33 UTC
Read the original article Hit count: 106

Filed under:

I have a categories table, which one of the fields serves as the foreign key for a sub-categories table. One field that serves as part of the primary key for each table is the language id. I need to update these in both tables. Basically, wherever the language id = x in both tables, I need to set it to y.

When I try to do an update on either table, I get a 'The UPDATE statement conflicted with the REFERENCE constraint..' which refers to the foreign key constraint.

How can I update the language field on both of these tables?

© Stack Overflow or respective owner

Related posts about sql