| Login

Search this Blog


Links I like to keep around


Here are the most recent postings to this blog. Use the archive calendar or search to find other entries.
Dec31

Written by:R Teachout
12/31/2007 11:03 AM 

Use this SQL server script from the SQL query window to rename an existing database. The script below will place the database in single user mode then rename the device and put then new device name back into multi user mode for use.

Use this SQL server script from the SQL query window to rename an existing database. The script below will place the database in single user mode then rename the device and put then new device name back into multi user mode for use.

 

SQL Script:

 

Use Master

Go

 

Sp_DbOption <Current_Database>, 'Single User', True

Go

 

Exec Sp_ReNameDb '', ''

Go

 

Sp_DbOption <New_Database_Name>, 'Single User', False

Go

 

Note: You must restart or refresh the Query Analyzer to view the name change

 



Archived from: http://myitforum.com/cs2/blogs/dhite/archive/2007/12/30/sql-script-to-rename-an-existing-sql-server-database.aspx

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment  Cancel 

Instead of plug and play - in the Microsoft world you plug it in and play around with it for a few weeks..."
-Sun Microsystems President Scott McNealy

Inspired by Nina