SQLTeam.com | Weblogs | Forums

Need SQL Join Help!

I need to update a column called bk_number within two tables that appear to be linked. I am not able to run the SQL to update one table first and then to update the other table afterwards because of the relationship between the tables. When I do try to update just one table, I get the following error message:
ERROR [23000] [Microsoft][SQL Server Native Client 11.0][SQL Server]The UPDATE statement conflicted with the FOREIGN KEY constraint "bk_document_dtl_1". The conflict occurred in database "Production_finance", table
ERROR [01000] [Microsoft][SQL Server Native Client 11.0][SQL Server]The statement has been terminated.

Here is the information for the update I need to make:

Table 1 = bk_document_dtl

Table 2 = bk_document_mstr

Column to be updated = bk_number (the column name is the same in both tables)

Condition = set bk_number = '00002952' where bk_number = '00005888' (in other words, I just need to change the check/bk number from 00005888 to 00002952 in both tables)

Any help would be greatly appreciated!
Thank you!

right click on each table and select CREATE to and post back here

1 Like

Thank you for your response! I am working through a product that is a part of a financial software suite and when I right click on the tables, it doesn't appear that I have those options. I'm attaching a screenshot here and although it's not visible, I am trying to right click on the table that is highlighted blue. On the right hand side, you can see what I most recently tried and you can view the error I'm receiving below it. If you have any other ideas, I would appreciate your help!
Thank you!

Are you working with Microsoft SQL Server?