Skip to content

Instantly share code, notes, and snippets.

@JohnLBevan
Created November 11, 2019 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnLBevan/c6b49f11b87ed04d49ffb1b9be39f4a2 to your computer and use it in GitHub Desktop.
Save JohnLBevan/c6b49f11b87ed04d49ffb1b9be39f4a2 to your computer and use it in GitHub Desktop.
SP_WHO2 Wrapper; to make filtering SP_WHO2's simple
declare @sp_who2 table (
Spid int
,[Status] varchar(255)
,[Login] varchar(255)
,HostName varchar(255)
,BlkBy varchar(255)
,DBName varchar(255)
,Command varchar(255)
,CpuTime int
,DiskIo int
,LastBatch varchar(255)
,ProgramName varchar(255)
,Spid2 int
,RequestId int
)
insert into @sp_who2 exec sp_who2
select * from @sp_who2 where DbName = 'dbname'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment