Skip to content

Instantly share code, notes, and snippets.

@MajidSafari
Created May 30, 2017 07:43
Show Gist options
  • Save MajidSafari/02af171fd94140287448b088688a6443 to your computer and use it in GitHub Desktop.
Save MajidSafari/02af171fd94140287448b088688a6443 to your computer and use it in GitHub Desktop.
ALTER DATABASE [old_name]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE [old_name]
MODIFY NAME = [new_name]
GO
ALTER DATABASE [new_name]
SET MULTI_USER
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment