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;
ALTER DATABASE srcDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
sp_rename 'srcDatabaseName' , 'destDatabaseName' ,'DATABASE';
GO
ALTER DATABASE destDatabaseName SET MULTI_USER;
Comments
Post a Comment