Created
July 10, 2017 15:42
-
-
Save ricklentz/a7e618839994acda3ab22fa58b4356f5 to your computer and use it in GitHub Desktop.
Characterize SQL SERVER (offending) processes for targeting will KILL {PID}
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
| -- Characterize offending processes for targeting will KILL (pid) | |
| Declare @T Table (SPID INT, | |
| Status VARCHAR(1000) NULL, | |
| Login SYSNAME NULL, | |
| HostName SYSNAME NULL, | |
| BlkBy SYSNAME NULL, | |
| DBName SYSNAME NULL, | |
| Command VARCHAR(1000) NULL, | |
| CPUTime INT NULL, | |
| DiskIO INT NULL, | |
| LastBatch VARCHAR(1000) NULL, | |
| ProgramName VARCHAR(1000) NULL, | |
| SPID2 INT | |
| , rEQUESTID INT NULL) | |
| Insert @T EXEC sp_who2 | |
| SELECT DISTINCT(DBName) FROM @T | |
| Select SPID from @T |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment