Special situations often arise in database development where it is convenient
to temporarily disable constraints. For example, it is often easier to load
initial values into a database one table at a time, without worrying with
foreign key constraints and checks until all of the tables have finished
loading. After the import is complete, you can turn constraint checking back on
and know the database is once again protecting the integrity of the data. You
can do this by using the following commands:
ALTER TABLE [TableName] NOCHECK CONSTRAINT [ConstraintName]
-- Do your updates here
ALTER TABLE [TableName] CHECK CONSTRAINT [ConstraintName]
In order to disable or enable all constraints use "ALL" instead of [ConstraintName]
in the above commands.
Note that the only constraints you can disable are the FOREIGN KEY constraint,
and the CHECK constraint. PRIMARY KEY, UNIQUE, and DEFAULT constraints are
always active.
To read more about this subject visit the following page:
Microsoft
SQL Server Constraints