SQL Server › Change Data Capture (CDC)
How do you enable Change Data Capture on a specific table, and what does that process actually create?
IntermediateAnswer
You first enable CDC at the database level using sp_cdc_enable_db, and then enable it for a specific table using sp_cdc_enable_table, which creates a corresponding change table that automatically captures every insert, update, and delete made to the original table going forward, along with the specific columns that changed.
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'Customers',
@role_name = NULL,
@supports_net_changes = 1;Real-world example A company enables CDC on their customers table, allowing their integration team to query a dedicated change table to see every customer record that was added, updated, or removed since their last data sync.