Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database template

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi! I'm new to SQL Server 7 and I hope I could get some help. I'd like to duplicate an empty database and use the duplicate for the transactions. I want the empty database to somehow act like a template so, whenever I want to, I could create a new instance of it. Problem is I don't know if it is possible to do that on SQL server (it's possible in Access). If it is possible, I hope any of you could tell me how. Thanks.
 
The "Model" Database is the template database for SQL Server and all new Databases use it as a template when they are created. You could use this as a template, however this will be the template for all databases created.

I think that it would be better to script the empty database you want to create and run the script against new databases to replicate your original database, that way you are not making any changes to the "Model" database which might present problems in the future and you are producing a copy of your original database.

Hope this helps
Good Luck
Bernadette
 
Thanks for the information, but I have another question...
does this note -> "script the empty database you want to create and run the script against new databases to replicate your original database"
mean that I have to create a stored procedure (on the existing db I have) and replicate it? would it be possible for me to issue a "copy" command in the stored procedure?
 
Hi Again Dredie

You can create a SQL Script and storing it on your Harddrive (In the Backup Folder is a good place in case you need it in the event of a diaster) You can then run this script via Query Analyser
Or
You can create a stored procedure in the Master Database and take the name of the new database to be created as a parameter.

Use Enterprise Manager -> Your Database -> All Taks -> Generate Scripts to generate the code for you.

There is no "COPY" command in SQL Server to copy a database.

Good Luck with this
Bernadette s-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top