Trail Blazer Knowledge Base:


Home : MS SQL Server : How to rename a MS SQL database?

Knowledge Base







User:

Password:



Article ID: KB15
Keyword Name:
Created: March 30, 2012
Viewed: 4024

How to rename a MS SQL database?

Run the following commands in the master database. You will need admin rights on the server to execute them. oldname is the old name of your DB and newname is the new name.

use master
go
sp_dboption 'oldname', 'single user', 'TRUE'
go
sp_renamedb 'oldname', 'newname'
go

-- The database name 'newname' has been set.
sp_dboption 'newname', 'single user', 'FALSE'
go

 

Notes:

1) The .MDF and .LDF file names will not be renamed. 

2) The Logical Names of the databases will not change. You can change these through MS SQL Studio Manager.



Find our more information about Trail Blazer Campaign Services Inc. [click here]


Powered by: ClickCarts KnowledgeBase