我使用下面的代码在表上启用了 CDC,默认情况下它包括所有列。还有另一种方法可以在指定列时在表上启用 CDC(代码如下)。但是,对我来说,为时已晚 - 鉴于我的 CDC 已经创建并包含所有列。如何从 CDC 监视列表中删除我不想要的列(我在元数据中到处搜索,但找不到任何东西):
-- The following enabled the CDC on a table:
EXECUTE sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'TableName',
@role_name = N'cdc_Admin',
@supports_net_changes = 1
-- Now all of the columns are included in the CDC.
--Alternate (which is too late now given my CDC on table was already created/performed)
EXECUTE sys.sp_cdc_enable_table
@source_schema = N'dbo' ,
@source_name = N'Orders' ,
@role_name = N'cdc_Admin' ,
@captured_column_list = N'OrderID,CustomerAccount,Product,SalesPerson'