Sql server rename database

This article is tagged with: Sql server rename database and mysql

alter database name script

USE master;
GO
ALTER DATABASE MyTestDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE MyTestDatabase MODIFY NAME = MyTestDatabaseCopy ;
GO
ALTER DATABASE MyTestDatabaseCopy SET MULTI_USER
GO

sql server rename database

ALTER DATABASE MyTestDatabase MODIFY NAME = MyTestDatabaseCopy ;

This article is tagged with: Sql server rename database and mysql