delete a value in a table with foreign key constraint code example
Example 1: how to remove foreign key constraint in sql
USE AdventureWorks2012;
GO
ALTER TABLE dbo.DocExe
DROP CONSTRAINT FK_Column_B;
GO
Example 2: on delete of foreign key delete corresponding rows in other table
ALTER TABLE ReferencingTable DROP
CONSTRAINT fk__ReferencingTable__MainTable;
ALTER TABLE ReferencingTable ADD
CONSTRAINT fk__ReferencingTable__MainTable
FOREIGN KEY (pk_col_1)
REFERENCES MainTable (pk_col_1)
ON DELETE CASCADE;