I need to be able toCREATE DATABASE by copying an existing database.
I would be doing this inside of a web app during an event.
How do I set this up on SQL 2005 ?
Thanks!
Here's an article on how to do it in PostgreSQL http://www.enterprisedb.com/documentation/manage-ag-templatedbs.htmlSQL Server 2005 has 'Copy Database Wizard' in Management Studio; you can also copy databases with Backup and Restore. But both methods seems not so easier to be done inside of web app during an event. Anyways you can take a look at 'Copying Databases to Other Servers' topic in SQL2005 Books Online.|||What if i made a backup of my "template" db
then had a stored proc like:
create procedure restoredb
@.dbname sysname
as
restore database @.dbname from disk='c:\backup.bak'
with move 'file_data' to 'd:\mssql\mssql\data\' + @.dbname + '_data.mdf',
move 'file_log' to 'd:\mssql\mssql\data\' + @.dbname + '_log.ldf',
replace
that created the new db
No comments:
Post a Comment