(te*****@magaff.co.uk) writes:
I have a MSSQL2000 box with a large database containing circa 150 SP's.
I want to move the DB to another SQL machine, but many of the SP's have
references to the name of the current machine. Is there any way to
batch edit the procedures to refer to the new server, disassociating
the old machine completely?
Check out the files from the version-control system, and use an editor
like Textpad to do search/replace in the files.
You don't have the code under version-control? Well, you should. :-) You
can always script out the procedures from Enterprise Manager and then
apply the same procedure. In this case, it's probably easier to have all
in one file.
I don't really know why have the machine code hard-coded all over the
place. Maybe it would be better to use @@servername, so you don't have
to redo the exercise next time you move?
--
Erland Sommarskog, SQL Server MVP,
es****@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx