Delete Constraint Key T-SQL

Drop Constraint Key Example

To delete a constraint key from an existing table, use the command alter table with drop constraint.

Create Constraint Foreign Key

USE tempdb;
GO
ALTER TABLE dbo.EMPLOYEES
ADD CONSTRAINT FK_DEPT_ID FOREIGN KEY(DEPT_ID)
REFERENCES dbo.DEPARTMENTS(ID);
GO

Delete Constraint Foreign Key

USE tempdb;
GO
ALTER TABLE dbo.EMPLOYEES
DROP CONSTRAINT FK_DEPT_ID;
GO