-- CDC -- Step 1: Check SQL Server Agent -- Step 2:Enable CDC at Database Level Query - EXEC sys.sp_cdc_enable_db; --Verify CDC enabled for database SELECT name,is_cdc_enabled FROM sys.databases WHERE name = 'YourDatabaseName'; --if is_cdc_enabled = 1, CDC is enabled. --Step 3: Enable CDC for a Table EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = 'Employee', @role_name = NULL; -- Step 4: Verify CDC Enabled for Table SELECT name,is_tracked_by_cdc FROM sys.tables WHERE name = 'Employee'; --Step 5: Check CDC Tables SELECT * FROM cdc.change_tables; --You may see: 'cdc.dbo_Employee_CT' -- Step 6: Test CDC Insert,Update,Delete --Step 7: Read CDC Data SELECT * FROM cdc.dbo_Employee_CT; Step 8: Disable CDC (Optional) EXEC sys.sp_cdc_disable_table @source_schema = 'dbo', @source_name = 'Employee', @capture_instance = 'dbo_Employee'; -- Disable database CDC EXEC sys.sp_cdc_disable_db; -- Important Notes CDC is available in: SQL Server Enterprise Standard Edition (SQL Server 2016 SP1 and later) Table must have a: Primary Key (recommended) Or unique index SQL Server Agent must remain running Architecture Overview Table Changes ↓ Transaction Log ↓ CDC Capture Job ↓ cdc._CT Table ↓ Query CDC Data