|
|
Question : How to turn off referential integrity for importing/replacing/deleti<wbr />ng validated data
|
|
Hi all:
Have a question: I basically have database 1 and database 2. Same databases (with regards to tables, etc.), but different values. I want to a) delete values in certain table (validated) from database 1 and b) import the values from database 2 to the same tables that was deleted from database 1. The key here is that it is important that the original data in database 1 is replaced with data from database 2.
I was wondering if there is any way to globally turn off any validation (referential integrity) on a MS SQL database for this import, then turn it back once I have completed the import.
Thanks!
A
|
Answer : How to turn off referential integrity for importing/replacing/deleti<wbr />ng validated data
|
|
You mean how to disable a constraint for insert
Disable the constraint
ALTER TABLE tablename NOCHECK CONSTRAINT constraintname
enable the constraint
ALTER TABLE tablename CHECK CONSTRAINT constraintname
|
|
|
|