0
Q:
Copying databases in SQL Server 2005 and SQL Server 2008
In SQL Server 2005 and SQL Server 2008, the CREATE DATABASE function creates a new database and copies all the tables that are present in the model database. Is there a function where I can do the same from a template database?
ASKED: Jul 28 2008  3:39 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
47070 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
You have a couple of options here.

1. Create a backup of the sample database, and instead of using the CREATE DATABASE command use the RESTORE DATABASE command and restore the backup of the template to the new database.

2. Add the objects you want in every database into the model database.

If you have more than one server to deal with, and you want them to all use the same template then use option #1 so that you always use the same template backup for each server. You could even save the backup script so that you just change the database name in the script and run the script and your restore would kick off.
Last Answered: Jul 28 2008  8:42 PM GMT by Mrdenny   47070 pts.
Latest Contributors: Tpinky   4165 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Mrdenny   47070 pts.  |   Jul 28 2008  8:42PM GMT

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.

 
0