| 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.

 

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:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel  

Any society that would give up a little liberty to gain a little security will deserve neither and lose both.
-Benjamin Franklin

Inspired by Nina