it "DB1") and replace it with a brand new empty database (let's call it
"DB2").
Caveat: I don't want to be left with database "DB1" having it's files
confusingly named "DB2.mdf" and "DB2_log.ldf". These two files should
also be renamed to "DB1.mdf" and "DB1_log.ldf" so that outside
customers are not left confused. In addition, I need to be able to
restore the original DB1 if anything goes wrong during, or even after,
the entire process.
Let's assume every customer's *.mdf's and *.ldf's will always reside in
C:\Program Files\Microsoft SQL Server\MSSQL\data folder.
I've researched sp_attach_db, but this looks more appropriate for
moving databases. This isn't what I want to do.
Thank you in advance.Simple.. In EM you can right right the database and "All tasks -
Generate SQL Script".. Go through and choose want you want to script
i.e. tables, views, stored procs, constraints, create database etc
etc.. Save the script as a .sql on your computer.. Open the file in a
text editor or SQL QA - modify the create database command and add a
"drop database" command at the top.
No comments:
Post a Comment