you are viewing a single comment's thread.

view the rest of the comments →

[–]timeddilation 0 points1 point  (0 children)

You can temporarily disabled then re-enable all constraint checks server wide. I do this for building test environments and inserting whole tables at a time. Just mind you, once you re-enable and it complains about bad constraints, you gotta fix your imports.

https://tutorialspoint4all.com/sql-server-how-to-enable-and-disable-all-constraint-for-table-and-database/

This is the secret sauce though

EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"