Skip to content

Latest commit

 

History

History
108 lines (80 loc) · 3.27 KB

sys-sp-flush-commit-table-on-demand-transact-sql.md

File metadata and controls

108 lines (80 loc) · 3.27 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sys.sp_flush_commit_table_on_demand (Transact-SQL)
Deletes rows from syscommittab in batches.
JetterMcTedder
bspendolini
randolphwest
08/21/2024
sql
system-objects
reference
sp_flush_commit_table_on_demand
sp_flush_commit_table_on_demand_TSQL
sys.sp_flush_commit_table_on_demand
sys.sp_flush_commit_table_on_demand_TSQL
sys.sp_flush_commit_table_on_demand
sp_flush_commit_table_on_demand
TSQL

sys.sp_flush_commit_table_on_demand (Transact-SQL)

[!INCLUDE SQL Server]

Deletes rows from syscommittab in batches.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_flush_commit_table_on_demand
    [ @numrows = ] numrows
    , [ @deleted_rows = ] deleted_rows OUTPUT
    , [ @date_cleanedup = ] date_cleanedup OUTPUT
    , [ @cleanup_ts = ] cleanup_ts OUTPUT
[ ; ]

Arguments

[ @numrows = ] numrows

Specifies the number of rows you want to delete from syscommittab. @numrows is bigint, and can't be NULL.

[ @deleted_rows = ] deleted_rows OUTPUT

@deleted_rows is an OUTPUT parameter of type bigint.

[ @date_cleanedup = ] date_cleanedup OUTPUT

@date_cleanedup is an OUTPUT parameter of type datetime.

[ @cleanup_ts = ] cleanup_ts OUTPUT

@cleanup_ts is an OUTPUT parameter of type bigint.

Return code values

0 (success) or 1 (failure).

Examples

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

[!INCLUDE ssresult-md]

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

Remarks

This procedure must be run in a database that has change tracking enabled.

Permissions

Only a member of the sysadmin server role or db_owner database role can execute this procedure.

Related content