Skip to content

Instantly share code, notes, and snippets.

@ricklentz
Created July 10, 2017 15:42
Show Gist options
  • Select an option

  • Save ricklentz/a7e618839994acda3ab22fa58b4356f5 to your computer and use it in GitHub Desktop.

Select an option

Save ricklentz/a7e618839994acda3ab22fa58b4356f5 to your computer and use it in GitHub Desktop.
Characterize SQL SERVER (offending) processes for targeting will KILL {PID}
-- 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