Hi

sp_who with filters

 SELECT  spid,

        sp.[status],

        loginame [Login],

        hostname, 

        blocked BlkBy,

        sd.name DBName, 

        cmd Command,

        cpu CPUTime,

        physical_io DiskIO,

        last_batch LastBatch,

        [program_name] ProgramName   

FROM master.dbo.sysprocesses sp 

JOIN master.dbo.sysdatabases sd ON sp.dbid = sd.dbid

where sd.name<>'master' and sd.name<>'msdb' and sp.[status]='sleeping                      '

ORDER BY spid 

Previous
Next Post »