sys.sp_xtp_control_proc_exec_stats (Transact-SQL)sys.sp_xtp_control_proc_exec_stats (Transact-SQL)

適用於: 是SQL Server 否Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

啟用執行個體的原生編譯預存程序的統計資料收集。Enables statistics collection for natively compiled stored procedures for the instance.

若要在原生編譯預存程式的查詢層級啟用統計資料收集,請參閱sys.databases (transact-sql)sp_xtp_control_query_exec_stats To enable statistics collection at the query level for natively compiled stored procedures, see sys.sp_xtp_control_query_exec_stats (Transact-SQL).


sp_xtp_control_proc_exec_stats [ [ @new_collection_value = ] collection_value ], [ @old_collection_value]  


@new_collection_value=*值*@new_collection_value = value
決定程序層級統計資料收集為開啟 (1) 或關閉 (0)。Determines whether procedure-level statistics collection is on (1) or off (0).

@new_collection_value當或資料庫啟動時SQL ServerSQL Server ,會設定為零。@new_collection_value is set to zero when SQL ServerSQL Server or the database starts.

@old_collection_value=*值*@old_collection_value = value
傳回目前狀態。Returns the current status.

傳回碼Return Code

0 代表成功。0 for success. 非零代表失敗。Nonzero for failure.


需要固定系統管理員 (sysadmin) 角色的成員資格。Requires membership in the fixed sysadmin role.

程式碼範例Code Samples

若要@new_collection_value設定並查詢的值@new_collection_value: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 sp_xtp_control_proc_exec_stats @old_collection_value=@c output  
select @c as 'collection status'  

另請參閱See Also

系統預存程序 (Transact-SQL) System Stored Procedures (Transact-SQL)
記憶體內部 OLTP (記憶體內部最佳化)In-Memory OLTP (In-Memory Optimization)