SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Rename SQL Server 2000 DB?
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

MikeB
Constraint Violating Yak Guru

Canada
387 Posts

Posted - 03/06/2004 :  08:34:51  Show Profile
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!

Australia
4970 Posts

Posted - 03/06/2004 :  08:38:45  Show Profile  Visit Merkin's Homepage
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

Canada
387 Posts

Posted - 03/06/2004 :  09:09:56  Show Profile
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

USA
15665 Posts

Posted - 03/06/2004 :  09:11:50  Show Profile  Visit robvolk's Homepage
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!

Australia
4970 Posts

Posted - 03/06/2004 :  09:13:52  Show Profile  Visit Merkin's Homepage
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
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000