I have created script to copy database schema and all the objects. Next, I use this command, C:> sqlcmd –S main\mssqlserver – i c:\test\script.sql to copy the "source" database to the another machine (for testing purpose). It pops up error, "...The INSERT statement conflict with the CHECK constraint "CK_field1"...". It also pops up errors with the Foreign Key constraints.
I have found this, How can foreign key constraints be temporarily disabled using T-SQL?
showing how to disable foreign key constraints temporarily. My question is do I need to do this on the "source" database BEFORE creating the script? And then after I am done creating the "destination" database, I need to go back to enable the constraints on the "source" db again? Thanks in advance for your help.