Skip to content

Instantly share code, notes, and snippets.

@MarioBinder
Last active August 18, 2020 13:24
Show Gist options
  • Save MarioBinder/c523a0022ec59b2f5684f7848f0e8dc0 to your computer and use it in GitHub Desktop.
Save MarioBinder/c523a0022ec59b2f5684f7848f0e8dc0 to your computer and use it in GitHub Desktop.
kill database process by dbname
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