Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 disable constraints

Author  Topic 

helpme
Posting Yak Master

141 Posts

Posted - 2005-03-07 : 16:45:08
I have a database that is built (including tables and their foreign keys) from a 3rd party software installation program. We currently have this software loaded on another machine, but with an oracle database. I want to move the software to a new server with an sql database instead of oracle. I have installed the software and now want to copy the data from the oracle database into the sql database. I'm having problems, due to RI constraints (I'm using a dts package created from the import/export wizard and the data isn't loading in the correct order for the RI).

My question....I want to disable all the RI constraints on all the tables prior to the load, and re-enable them after the load. What is the easiest way of doing this? In oracle, you could just spool off statements using the view "user_constraints" and run these statements to disable the constraints (and later spool off statements to enable the constraints). I'm assuming there is something that would work similarly to this in SQL???


Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-03-07 : 17:16:48
You would have to do ALTER TABLE DROP CONSTRAINT and then add them again later.

You are probably better off just changing your DTS package to load the data in the correct order, since it would prevent data integrity issues.




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -