ALTER DATABASE [oldDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO ALTER DATABASE [oldDB] MODIFY NAME = newDB GO ALTER DATABASE newDB SET MULTI_USER GO
ALTER DATABASE [oldDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO ALTER DATABASE [oldDB] MODIFY NAME = newDB GO ALTER DATABASE newDB SET MULTI_USER GO