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

Tibco Rendezvous (tibrv) C# .Net example

Parse XML to dynamic object in C#