sys.sp_flush_commit_table_on_demand (Transact-SQL)
適用於:SQL Server
從批次中刪除數據列 syscommittab
。
語法
sp_flush_commit_table_on_demand
[ @numrows = ] numrows
, [ @deleted_rows = ] deleted_rows OUTPUT
, [ @date_cleanedup = ] date_cleanedup OUTPUT
, [ @cleanup_ts = ] cleanup_ts OUTPUT
[ ; ]
引數
[ @numrows = ] numrows
指定要從 syscommittab 刪除的數據列數目。 @numrows是 bigint,而且不能NULL
。
[ @deleted_rows = ] deleted_rows OUTPUT
@deleted_rows是 bigint 類型的 OUTPUT 參數。
[ @date_cleanedup = ] date_cleanedup OUTPUT
@date_cleanedup是 datetime 類型的 OUTPUT 參數。
[ @cleanup_ts = ] cleanup_ts OUTPUT
@cleanup_ts是 bigint 類型的 OUTPUT 參數。
傳回碼值
0
(成功) 或 1
(失敗)。
範例
DECLARE @deleted_rows BIGINT;
DECLARE @date_cleanedup DATETIME;
DECLARE @cleanup_ts BIGINT;
EXEC sys.sp_flush_commit_table_on_demand 3000,
@deleted_rows = @deleted_rows OUTPUT,
@date_cleanedup = @date_cleanedup OUTPUT,
@cleanup_ts = @cleanup_ts OUTPUT;
PRINT CONCAT ('Number of rows deleted: ', @deleted_rows);
PRINT CONCAT ('Cleanup date: ', @date_cleanedup);
PRINT CONCAT ('Change tracking version: ', @cleanup_ts);
GO
結果集如下所示。
Started executing query at Line 1
The value returned by change_tracking_hardened_cleanup_version() is 17.
The value returned by safe_cleanup_version() is 17.
(0 rows affected)
Number of rows deleted: 100
Cleanup date: Aug 29 2022 8:59PM
Change tracking Version: 17
Total execution time: 00:00:02.008
備註
此程式必須在已啟用變更追蹤的資料庫中執行。
權限
只有系統管理員伺服器角色或db_owner資料庫角色的成員才能執行此程式。