To Disable and enable constraints

To disable and enable constraints with check (only for those table which do not violates data)


EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"


exec sp_msforeachtable @command1="print '?'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"

Comments

Popular posts from this blog

Grouping Sets, With Rollup and With Cube example

Adding Page brake aganist group values

To Get All the Names of tables and Databases their data have changed in last 24 Hours And Backup those databases