Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

Foreign key constraint error with delete

$
0
0

error message:
(i changed the names slightly)

Message
Executed as user: ***. The DELETE statement conflicted with the REFERENCE constraint "fk_child_table_detail_id". The conflict occurred in database "ABC", table "dbo.child_table_detail", column 'parent_table_master_id'. [SQLSTATE 23000] (Error 547)  The statement has been terminated. [SQLSTATE 01000] (Error 3621).  The step failed.

So I have this 3rd party system process that involves several procedures.  These procedures are responsible for "archiving" data from several tables, and in a specific sequence.  The detail tables are archived first, then the main table. Not sure why now we are getting this error.

Its obvious that the constraint is preventing the delete on the table in question.  However, its the child table that is giving the error, not the main table.

I DO NOT want to remove the constraints, as Ive seen mentioned before elsewhere online.

Any suggestions?


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>