Created
March 4, 2017 04:36
-
-
Save jtanios/2522394b7ec267895aa04a9da002af58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Shows process IDs using MyDatabase | |
SELECT SPId FROM master..SysProcesses | |
WHERE DBId = DB_ID('MyDatabase') AND SPId <> @@SPID | |
-- Run this for each process ID | |
KILL <process_id> | |
-- Take offline | |
ALTER DATABASE [MyDatabase] SET OFFLINE WITH ROLLBACK IMMEDIATE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment