Foreign key constraint error with delete


error message:
(i changed names slightly)

message
executed user: ***. delete statement conflicted reference constraint "fk_child_table_detail_id". 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 have 3rd party system process involves several procedures.  these procedures responsible "archiving" data several tables, , in specific sequence.  the detail tables archived first, main table.  not sure why getting error.

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

i not want remove constraints, ive seen mentioned before elsewhere online.

any suggestions?

sorry, after looking bit further, there yet detail table had foreign key references child table.



SQL Server  >  SQL Server Database Engine



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........