How to rename a database in the MS SQL server:
Use the below code to rename a database in the MS SQL server -
USE master; GO ALTER DATABASE Database01 SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO ALTER DATABASE Database01 MODIFY NAME = Database02 ; GO ALTER DATABASE Database02 SET MULTI_USER GO