How to disable constraints in database?

Aman Sharma
0
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.


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'


Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !