The Delete Statement Conflicted With The Reference Constraint
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'.
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'
Larnu1 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 ...