Turn off constraints temporarily (MS SQL)

I’m looking for a way to temporarily turn off all DB’s constraints (eg table relationships).

I need to copy (using INSERTs) one DB’s tables to another DB.
I know I can achieve that by executing commands in proper order (to not break relationships).

But it would be easier if I could turn off checking constraints temporarily and turn it back on after the operation’s finish.

Is this possible?

5 Answers
5

Leave a Comment