Rename SQL Server Database from sql queries
Queries to rename database in SQL Server :-
Step 1: Enable Single user mode on database
ALTER DATABASE database_name
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Step 2: Change database name
ALTER DATABASE database_name MODIFY NAME = New_database_name
Step 3: enable multi user mode on database
ALTER DATABASE New_database_name
SET MULTI_USER WITH ROLLBACK IMMEDIATE
Its done :)
Step 1: Enable Single user mode on database
ALTER DATABASE database_name
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Step 2: Change database name
ALTER DATABASE database_name MODIFY NAME = New_database_name
Step 3: enable multi user mode on database
ALTER DATABASE New_database_name
SET MULTI_USER WITH ROLLBACK IMMEDIATE
Its done :)
Comments