How to filter sp_who2 information

DECLARE @sp_who2 TABLE 
(
SPID INT,
Status VARCHAR(255) NULL,
Login SYSNAME NULL,
HostName SYSNAME NULL,
BlkBy SYSNAME NULL,
DBName SYSNAME NULL,
Command VARCHAR(255) NULL,
CPUTime INT NULL,
DiskIO INT NULL,
LastBatch VARCHAR(255) NULL,
ProgramName VARCHAR(255) NULL,
SPID2 INT,
REQUESTID INT
)

INSERT @sp_who2 EXEC sp_who2

SELECT * FROM @sp_who2
WHERE Status > 'BACKGROUND'

Comments

Popular posts from this blog

Parse XML to dynamic object in C#

C# Crop white space from around the image