Question

I am looking at doing some profiling of connections types and volumes across the day.

I am using the sys.sysprocesses to gather the information I require, looking specifically at the 'cmd' field to categorize connections. Does anyone have a good comprehensive list of definitions for the values in this field? I can figure out what a lot of them represent, but I can't find online any definitions for some of them, for example 'XE TIMER'

Many thanks,

Was it helpful?

Solution

As suggested in comment sys.sysprocesses is deprecated and Microsoft does not recommends it to use further. Its just there for backward compatibility

The above view has been replaced by sys.dm_exec_requests. You would see cmd column from sys.sysprocesses is now command column in sys.dm_exec_requests and this column tells you

Identifies the current type of command that is being processed. Common command types include the following:

• SELECT

• INSERT

• UPDATE

• DELETE

• BACKUP LOG

• BACKUP DATABASE

• DBCC

• FOR

The text of the request can be retrieved by using sys.dm_exec_sql_text with the corresponding sql_handle for the request. Internal system processes set the command based on the type of task they perform. Tasks can include the following: • LOCK MONITOR

• CHECKPOINTLAZY

• WRITER

Is not nullable.

Instead I suggest you to focus on column sql_handle which is present in sys.dm_exec_requests. Below code would give you query behind sql_handle

select er.session_id,
er.command,
t.text --gives query behind sql_handle
from sys.dm_exec_requests er
cross apply sys.dm_exec_sql_text(er.sql_handle) t
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top