How SQL Server CDC Works (Step-by-Step)
Native SQL Server CDC operates through a series of internal SQL Server Agent jobs. Here is the architectural flow:
Transaction Log Execution: When a user or application makes a change to a CDC-enabled table, the change is written to the SQL Server transaction log.
The Capture Job: A dedicated SQL Server Agent job (the "capture" process) continuously reads the transaction log to identify changes made to tracked tables.
Change Tables: The capture job writes the details of these modifications (including the before and after values) into dedicated CDC system tables (cdc.fn_cdc_get_all_changes_...).
Data Extraction: Downstream ETL tools or custom scripts query these system tables to extract the net changes and move them to a target destination.
The Cleanup Job: To prevent the database from bloating with historical change data, a secondary SQL Server Agent cleanup job runs periodically (typically every 3 days by default) to purge old records from the change tables.









