How to disable Foreign Key constraints using T-SQL in SQL Server ?

You can enable or disable the foreign key constraints for a table in a SQL Server using the ALTER statement.

How to disable Foreign Key constraints using T-SQL in SQL Server ?

Here’s the T-SQL query to disable all the constraints of the table “Employee”.

ALTER TABLE HumanResources.Employee NOCHECK CONSTRAINT ALL

If you want to enable all the constraints of the table , here’s how you do it.

ALTER TABLE HumanResources.Employee WITH CHECK CHECK CONSTRAINT ALL