sys.dm_broker_activated_tasks (Transact-SQL)

Applies to: SQL Server

Returns a row for each stored procedure activated by Service Broker.

Column name Data type Nullable Description
spid int Yes ID of the session of the activated stored procedure.
database_id smallint Yes ID of the database in which the queue is defined.
queue_id int Yes ID of the object of the queue for which the stored procedure was activated.
procedure_name nvarchar(325) Yes Name of the activated stored procedure.
execute_as int Yes ID of the user that the stored procedure runs as.

Permissions

SQL Server 2019 (15.x) and previous versions require VIEW SERVER STATE permission on the server.

SQL Server 2022 (16.x) and later versions require VIEW SERVER PERFORMANCE STATE permission on the server.

Physical joins

Diagram of physical joins for sys.dm_broker_activated_tasks.

Relationship cardinalities

From To Relationship
dm_broker_activated_tasks.spid dm_exec_sessions.session_id One-to-one