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.
| Author |
Topic |
|
Bex
Aged Yak Warrior
580 Posts |
Posted - 2005-07-12 : 05:37:05
|
| I have three identical databases residing on the same server:Developer_ArchiveIndex - For developing, playing with code, etcPrototype_ArchiveIndex - For Customer Acceptance testsTest_ArchiveIndex - The test suiteThe test database is the most important, as we have a number of tests automatically run against the DB every night. To ensure the database is in exactly the same state for each test, it is dropped, recreated and repopulated via a scheduled DTS package. I wanted to do the same for all databases, and run the script to generate the DB and run sp_renameDB to rename it for each of the three databases using the same script. However, the MDF and LDF files do not appear to be renamed causing the following error:cannot create file 'e:\mssql\data\Test_ArchiveIndex.mdf' because it already existsHow can I overcome this, or is there a simpler way to do it?Hearty head pats |
|
|
clarkbaker1964
Constraint Violating Yak Guru
428 Posts |
Posted - 2005-07-12 : 16:48:42
|
Create all of the objects in the model database, recommend a separate instance!execute drop databaseexecute create databaseall objects will be created exactly as they are in the model db and you can create as many of these as you like You can do anything at www.zombo.com |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-07-12 : 19:40:39
|
| I'm missing something here aren't I. Why don't use just use the RESTORE command with the WITH MOVE option???MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|