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.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Rename SQL Server 2000 DB?

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? If
not, is it possible to copy the tables and relationship diagram
from one to another? The database is new, so there are no records
to copy. I just want to rename it, because redoing the tables would
take 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
Go to Top of Page

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
Go to Top of Page

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.
Go to Top of Page

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
Go to Top of Page
   

- Advertisement -