Skip to content

Instantly share code, notes, and snippets.

@charlwillia6
Created February 21, 2017 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlwillia6/76e28fcfb801c2eb56907bcb3d32dc57 to your computer and use it in GitHub Desktop.
Save charlwillia6/76e28fcfb801c2eb56907bcb3d32dc57 to your computer and use it in GitHub Desktop.
Set SQL database to single user mode
USE master;
GO
ALTER DATABASE AdventureWorks2012
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE AdventureWorks2012
SET READ_ONLY;
GO
ALTER DATABASE AdventureWorks2012
SET MULTI_USER;
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment