Skip to main content

Rename database name in MSSQL

To rename the database is MSSQL, use below queries.

ALTER DATABASE srcDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
sp_rename 'srcDatabaseName' , 'destDatabaseName' ,'DATABASE';
GO
ALTER DATABASE destDatabaseName SET MULTI_USER;

Comments

Popular posts from this blog