June 4, 2008 at 12:18 pm
I would like a script to simply copy one database to another within the same server. I have seen a copy script to copy to remote location, but not one to copy within the same server with a different name. I am new to SQL Server so I dont think I could edit the copy script I have seen out there.
I would like to pass current_database_name and new_database_name within the script as parameters.
Does anyone have something like this?
Thanks
June 4, 2008 at 12:50 pm
The easiest way to do this is to backup the database you want to copy and restore the backup to a new database with a new name. You can see examples in BOL at ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/b7548d29-dd45-43ab-92cc-1e743a2d7a86.htm and ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/b4f4791d-646e-4632-9980-baae9cb1aade.htm
I haven't seen a script to do what you want to do, but if you post it here, you could get advice about what to change to make it work.
Greg
June 4, 2008 at 1:18 pm
I'd do the backup and restore thing. Be sure that you use WITH MOVE to move the files to new locations/names.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply