How to Rename a Database in MS SQL Server
You can rename a Database in MS SQL Server by using below command:
sp_renamedb 'CurrentName', 'New_Name'
If you or someone is already connected with Database this command may fail, In that situation , please use below command.
Alter Database 'CurrentName' Set Single_User with Rollback immediate go sp_renamedb 'CurrentName', 'New_Name' go Alter Database 'New_Name' Set Multi_user with Rollback immediate go
Comments
Post a Comment