We use various constraints in
database, which are very helpful to manage database.
We can disable particular one constraint
and can disable all constraints in table using query.
But sometimes while importing data for testing, we need to disable all constraints in one table or in whole database. We can use it for testing purpose only.
But sometimes while importing data for testing, we need to disable all constraints in one table or in whole database. We can use it for testing purpose only.
Disable all constraints in one table:
alter table table_name nocheck constraint all
Disable one constraint in one table:
alter table table_name nocheck constraint constraint_name
Disable constraints for all tables:
exec sp_msforeachtable 'alter table ? nocheck constraint all'