sys.sp_cdc_scan (Transact-SQL)

Applies to: SQL Server (all supported versions)

Executes the change data capture log scan operation.

Topic link icon Transact-SQL Syntax Conventions


sys.sp_cdc_scan [ [ @maxtrans = ] max_trans ]   
     [ , [ @maxscans = ] max_scans ]   
     [ , [ @continuous = ] continuous ]   
     [ , [ @pollinginterval = ] polling_interval ]   


[ @maxtrans = ] max_trans Maximum number of transactions to process in each scan cycle. max_trans is int with a default of 500.

[ @maxscans = ] max_scans Maximum number of scan cycles to execute in order to extract all rows from the log. max_scans is int with a default of 10.

[ @continuous = ] continuous Indicates whether the stored procedure should end after executing a single scan cycle (0) or run continuously, pausing for the time specified by polling_interval before reexecuting the scan cycle (1). continuous is tinyint with a default of 0.

[ @pollinginterval = ] polling_interval Number of seconds between log scan cycles. polling_interval is bigint with a default of 0.

Return Code Values

0 (success) or 1 (failure)

Result Sets



sys.sp_cdc_scan is called internally by sys.sp_MScdc_capture_job if the SQL Server Agent capture job is being used by change data capture. The procedure cannot be executed explicitly when a change data capture log scan operation is already active or when the database is enabled for transactional replication. This stored procedure should be used by administrators who want to customize the behavior of the capture job that is automatically configured.


Requires membership in the db_owner fixed database role.

See Also

dbo.cdc_jobs (Transact-SQL)