Last active
August 18, 2020 13:24
-
-
Save MarioBinder/c523a0022ec59b2f5684f7848f0e8dc0 to your computer and use it in GitHub Desktop.
kill database process by dbname
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
DECLARE @SQL varchar(max) | |
SELECT @SQL = COALESCE(@SQL,'') + 'kill ' + Convert(varchar, SPId) + ';' | |
FROM MASTER..SysProcesses | |
WHERE DBId = DB_ID(<DBNAME>) AND SPId <> @@SPId | |
--SELECT @SQL | |
--EXEC(@SQL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment