The Delete Statement Conflicted With The Reference Constraint

/ Comments off
The Delete Statement Conflicted With The Reference Constraint Average ratng: 5,9/10 218 reviews

But the error message doesn't include that information (in full it reads The DELETE statement conflicted with the REFERENCE constraint. The DELETE statement conflicted with the REFERENCE constraint: The DELETE statement conflicted with the REFERENCE constraint 'FKProgramResultProgramSnapshot'. The conflict occurred in database 'MyDB', table 'dbo.ProgramResult'.

  1. Delete Conflict With Reference Constraint
The delete statement conflicted with the reference constraint asp.net

I am trying to delete data from table i am getting following error

The DELETE statement conflicted with the REFERENCE constraint FKPROSPECTPLANATTACHMENTAUTHORID - When deleting a constituent.

The DELETE statement conflicted with the REFERENCE constraint 'FK_TradingPartnerControlID_TPGRU'. The conflict occurred in database 'GRiDSCore', table 'dbo.TradingPartnerGRU', column 'TradingPartnerControlID'.

I want to delete data from Table TradingPartnerControl where TradingpartnerID between '34' and '39'

Larnu
28.2k6 gold badges20 silver badges33 bronze badges
harish bhavandlaharish bhavandla

1 Answer

As far as its very clear from the error shown. Its due to foreign key constraint on your column in the table from which you are deleting. Either delete that record first in the referenced table or use CASCADE ...

Himanshu AhujaHimanshu Ahuja
1,0182 gold badges2 silver badges19 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Delete Conflict With Reference Constraint

Not the answer you're looking for? Browse other questions tagged sqlsql-server or ask your own question.