Skip to content

Latest commit

 

History

History
73 lines (50 loc) · 2.12 KB

sys-sp-xtp-control-proc-exec-stats-transact-sql.md

File metadata and controls

73 lines (50 loc) · 2.12 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sys.sp_xtp_control_proc_exec_stats (Transact-SQL)
Enables statistics collection for natively compiled stored procedures for the instance.
markingmyname
maghan
randolphwest
08/21/2024
sql
system-objects
reference
sys.sp_xtp_control_proc_exec_stats
sys.sp_xtp_control_proc_exec_stats_TSQL
sys.sp_xtp_control_proc_exec_stats
TSQL

sys.sp_xtp_control_proc_exec_stats (Transact-SQL)

[!INCLUDE sqlserver]

Enables statistics collection for natively compiled stored procedures for the instance.

To enable statistics collection at the query level for natively compiled stored procedures, see sys.sp_xtp_control_query_exec_stats.

Syntax

sys.sp_xtp_control_proc_exec_stats
    [ [ @new_collection_value = ] collection_value ]
    , [ @old_collection_value = ] old_collection_value OUTPUT
[ ; ]

Arguments

[ @new_collection_value = ] new_collection_value

Determines whether procedure-level statistics collection is on (1) or off (0). @new_collection_value is bit.

@new_collection_value is set to zero when [!INCLUDE ssNoVersion] or the database starts.

[ @old_collection_value = ] old_collection_value

Returns the current status. @old_collection_value is bit.

Return code values

0 for success. Nonzero for failure.

Permissions

Requires membership in the fixed sysadmin role.

Examples

To set @new_collection_value and query for the value of @new_collection_value:

EXEC sys.sp_xtp_control_proc_exec_stats @new_collection_value = 1;

DECLARE @c BIT;

EXEC sys.sp_xtp_control_proc_exec_stats @old_collection_value = @c OUTPUT;

SELECT @c AS 'collection status';

Related content