Thursday, April 16, 2009

SQL 2005 Processes Detailed Status Query

Use the quey below to find detailed information about processes.
How many process are working? , How many are sleeping..., and the total number of processes.

SELECT COUNT(*) AS ProcessStatusCount,CASE Status
WHEN 'Running' THEN 'Number of Process Currently Running One or More Requests '
WHEN 'Sleeping ' THEN 'Number of Process Currently Sleeping'
ELSE 'Dormant – Session resets
END Status
FROM sys.dm_exec_sessions GROUP BY Status

No comments:

Post a Comment

span.fullpost {display:inline;}