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

TSQL To Get All the Names of tables and Databases whose data have changed in last 24 Hours

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

Apply paging in procedure