Answers for "delete a value in a table with foreign key constraint"

SQL
1

how to remove foreign key constraint in sql

USE AdventureWorks2012;  
GO  
ALTER TABLE dbo.DocExe   
DROP CONSTRAINT FK_Column_B;   
GO
Posted by: Guest on September-24-2020
0

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;
Posted by: Guest on June-10-2020

Code answers related to "delete a value in a table with foreign key constraint"

Code answers related to "SQL"

Browse Popular Code Answers by Language