Created
August 23, 2019 20:11
-
-
Save jetstreamin/96ae46632fe37ec8ce9f7839345d00a1 to your computer and use it in GitHub Desktop.
SQL Kill All Connections
This file contains hidden or 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
USE [master]; | |
DECLARE @kill varchar(8000) = ''; | |
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), session_id) + ';' | |
FROM sys.dm_exec_sessions | |
WHERE database_id = db_id('LSST') | |
SELECT @kill | |
EXEC(@kill); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment