On Tue, 21 Nov 2006 10:39:21 -0800, George Shubin wrote:
>Using SQL Server 2005 Express.
I need to periodically duplicate an entire database and rename it. Most
tables are empty but some are to be prepopulated. I was thinking of having
a "template" database called perhaps "EmptyDatabase", and then copy that
into a freshly created database with a new name.
Has anyone coded anything like this?
Hi George,
One thing you can do is add these standard tables to the "model"
database. Each time you create a new database, it is created as a copy
of the "model" database, so each new database will have those tables.
If you don't want these tables in ALL new databases, then I'd create one
database with the required tables and make a full backup. You can then
create copies of that database by using RESTORE DATABASE with the WITH
MOVE option.
--
Hugo Kornelis, SQL Server MVP