Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 3.32 KB

sys-dm-clr-tasks-transact-sql.md

File metadata and controls

50 lines (41 loc) · 3.32 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
sys.dm_clr_tasks (Transact-SQL)
sys.dm_clr_tasks (Transact-SQL)
rwestMSFT
randolphwest
02/24/2023
sql
system-objects
reference
sys.dm_clr_tasks
sys.dm_clr_tasks_TSQL
dm_clr_tasks
dm_clr_tasks_TSQL
sys.dm_clr_tasks dynamic management view
TSQL
=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

sys.dm_clr_tasks (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

Returns a row for all common language runtime (CLR) tasks that are currently running. A [!INCLUDEtsql] batch that contains a reference to a CLR routine creates a separate task for execution of all the managed code in that batch. Multiple statements in the batch that require managed code execution use the same CLR task. The CLR task is responsible for maintaining objects and state pertaining to managed code execution, as well as the transitions between the instance of [!INCLUDEssNoVersion] and the common language runtime.

Column name Data type Description
task_address varbinary(8) Address of the CLR task.
sos_task_address varbinary(8) Address of the underlying [!INCLUDEtsql] batch task.
appdomain_address varbinary(8) Address of the application domain in which this task is running.
state nvarchar(128) Current state of the task.
abort_state nvarchar(128) State the abort is currently in (if the task was canceled) There are multiple states involved while aborting tasks.
type nvarchar(128) Task type.
affinity_count int Affinity of the task.
forced_yield_count int Number of times the task was forced to yield.

Permissions

On [!INCLUDEssNoVersion_md] and SQL Managed Instance, requires VIEW SERVER STATE permission.

On SQL Database Basic, S0, and S1 service objectives, and for databases in elastic pools, the server admin account, the Microsoft Entra admin account, or membership in the ##MS_ServerStateReader## server role is required. On all other SQL Database service objectives, either the VIEW DATABASE STATE permission on the database, or membership in the ##MS_ServerStateReader## server role is required.

Permissions for SQL Server 2022 and later

Requires VIEW SERVER PERFORMANCE STATE permission on the server.

See also

Dynamic Management Views and Functions (Transact-SQL)
Common Language Runtime Related Dynamic Management Views (Transact-SQL)