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)
 DTS Duplicate and rename a database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-12-21 : 18:29:15
Rich writes "Hello and thanks to the SQL Team.

We've got a system where each client has an individual database. Each time we get a new customer, the database must be detached, file copied, renamed, then reattached, as well as the origional db. We've got developers constantly at work on the "template" db, so when someone needs to create a new client, it stops production for all other developers (this is a legacy system that i'm trying to work with here, so please bear with me). I am trying to find a way to use DTS to create a new database from a variable name, that will be created, then populated with copies from a specified template database. I've found that if i create a blank db, i can then use DTS to copy all objects into the new db. Is there a way through DTS that you can create a new database from a variable name, then process the next step of populating it?

We are using MSSQL 2000 on windows server 2003

Thanks for all the great tips and help i've found throughout your site.

Best Regards,
Rich"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-12-21 : 18:40:08
Create a database that will be your template. Detach that database. Make a copy of the template MDF and LDF files. Rename the copy to whatever database name you are going to use. Attach the newly renamed MDF and LDF.

You could also achieve this with BACKUP/RESTORE.

DTS should not be used as it is the slowest method.

Tara Kizer
aka tduggan
Go to Top of Page
   

- Advertisement -