Skip to content

Instantly share code, notes, and snippets.

@tompazourek
Created January 24, 2018 09:38
Show Gist options
  • Save tompazourek/8cece2380739a8054d322250646a1ed6 to your computer and use it in GitHub Desktop.
Save tompazourek/8cece2380739a8054d322250646a1ed6 to your computer and use it in GitHub Desktop.
USE MASTER
ALTER DATABASE [DatabaseOldName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [DatabaseOldName] MODIFY NAME = [DatabaseNewName]
ALTER DATABASE [DatabaseNewName] SET MULTI_USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment