Skip to content

Instantly share code, notes, and snippets.

@gratzc
Created July 8, 2015 21:28
Show Gist options
  • Save gratzc/f06ea03aac63f85ee43b to your computer and use it in GitHub Desktop.
Save gratzc/f06ea03aac63f85ee43b to your computer and use it in GitHub Desktop.
CREATE TABLE #sp_who2
(
SPID INT,
Status VARCHAR(MAX),
LOGIN VARCHAR(MAX),
HostName VARCHAR(MAX),
BlkBy VARCHAR(MAX),
DBName VARCHAR(MAX),
Command VARCHAR(MAX),
CPUTime INT,
DiskIO INT,
LastBatch VARCHAR(MAX),
ProgramName VARCHAR(MAX),
SPID_1 INT,
REQUESTID INT
)
GO
INSERT INTO #sp_who2
EXEC sp_who2
GO
SELECT *
FROM #sp_who2
WHERE Login = 'edelta_user' AND Command <> 'AWAITING COMMAND'
ORDER BY BlkBy
GO
DROP TABLE #sp_who2
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment