Search This Blog

Monday, 5 March 2012

SQL Server sortable sp_who

Just a little helper to allow filtering and sorting of the SQL Server sp_who standard output:


declare @myTab table(
spid float,
ecid float,
[status] varchar(1000),
loginame varchar(1000),
hostname varchar(1000),
blk float,
dbname varchar(1000),
cmd varchar(1000),
request_id float
)


insert into @myTab
exec sp_who


select * from @myTab
where dbname not in (
'master',
'msdb',
'tempdb'
)
order by dbname 

No comments:

Post a Comment