|
Posted by Erland Sommarskog on 12/31/07 09:23
Neil (nospam@nospam.net) writes:
> I think that's a good idea. What about the idea of just exporting it to a
> blank db, like I did today, with the triggers, indexes, and constraints in
> place, and then reimporting it with those? Then only the referencing
> constraints would have to be recreated.
Whichever way you fancy, as long as you don't wreck anything.
But if you do it that way, you don't even have to drop the referencing
constraints, you only need to disable them:
ALTER TABLE tbl NOCHECK CONSTRAINT fk_this_that
to enable them, this is the command:
ALTER TABLE tbl WITH CHECK CHECK CONSTRAINT fk_this_that
A somewhat bizarre syntax, but without the WITH CHECK part, SQL Server
will just enable the constraints without checking them.
And whichever path you go, use SQL Compare as I suggested to verify that
you have all in place!
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|