Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
MikeB
Constraint Violating Yak Guru
387 Posts |
Posted - 2004-03-06 : 08:34:51
|
Is it possible to rename a database in SQL Server 2000? Ifnot, is it possible to copy the tables and relationship diagramfrom one to another? The database is new, so there are no records to copy. I just want to rename it, because redoing the tables wouldtake too much energy (<----Lazy). :)Mike B |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2004-03-06 : 08:38:45
|
The easiest way to do this is a backup and restore with a different name. Or a sp_detach_db and sp_attach_db with a different name.Damian |
|
|
MikeB
Constraint Violating Yak Guru
387 Posts |
Posted - 2004-03-06 : 09:09:56
|
quote: Originally posted by Merkin The easiest way to do this is a backup and restore with a different name. Or a sp_detach_db and sp_attach_db with a different name.Damian
Very good, the back up and restore worked great. Being a blank database it was easy, but would you do it this way with a populated database?Mike B |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-03-06 : 09:11:50
|
You can set the database to single user mode (gotta kick out all the users first), then run sp_renamedb, then set it back to multi-user. Works like a charm and takes under 30 seconds. |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2004-03-06 : 09:13:52
|
quote: would you do it this way with a populated database?
Well, I would... but as you can see, Rob knows more about SQL Server than me Damian |
|
|
|
|
|