Get modified column names from Change Data Capture
-
Hi All, I am using CDC to capture the modified data, all I need to know is which columns are modified on a particular day so that I can extract those modified columns. I am able to do it by using the CaptureInstance (like I have to use the name like this: cdc.fn_cdc_get_all_changes_CDC_Provider) name hard coded function, Is there any way I can get it by using the run time without using the hard coded name.
SELECT --sys.fn_cdc_map_lsn_to_time(__$start_lsn) AS 'Time', CAST(sys.fn_cdc_map_lsn_to_time(__$start_lsn) AS DATE),
@captureinstance, @ColName, sys.fn_cdc_is_bit_set(@TrackIfColumnChanges, __$update_mask)
--,fn_cdc_get_all_changes_CDC_Provider.__$operation
FROM cdc.fn_cdc_get_all_changes_CDC_Provider(@from_lsn, @to_lsn, 'all')
WHERE sys.fn_cdc_is_bit_set(@TrackIfColumnChanges, __$update_mask)=1
AND CAST(sys.fn_cdc_map_lsn_to_time(__$start_lsn) AS DATE) = CAST(GETDATE() AS DATE)Can anybody please give me any idea any code snippet, a link or even suggestion would help me a lot. Thanks in advance.
Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."
-
Hi All, I am using CDC to capture the modified data, all I need to know is which columns are modified on a particular day so that I can extract those modified columns. I am able to do it by using the CaptureInstance (like I have to use the name like this: cdc.fn_cdc_get_all_changes_CDC_Provider) name hard coded function, Is there any way I can get it by using the run time without using the hard coded name.
SELECT --sys.fn_cdc_map_lsn_to_time(__$start_lsn) AS 'Time', CAST(sys.fn_cdc_map_lsn_to_time(__$start_lsn) AS DATE),
@captureinstance, @ColName, sys.fn_cdc_is_bit_set(@TrackIfColumnChanges, __$update_mask)
--,fn_cdc_get_all_changes_CDC_Provider.__$operation
FROM cdc.fn_cdc_get_all_changes_CDC_Provider(@from_lsn, @to_lsn, 'all')
WHERE sys.fn_cdc_is_bit_set(@TrackIfColumnChanges, __$update_mask)=1
AND CAST(sys.fn_cdc_map_lsn_to_time(__$start_lsn) AS DATE) = CAST(GETDATE() AS DATE)Can anybody please give me any idea any code snippet, a link or even suggestion would help me a lot. Thanks in advance.
Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."
What is CDC?
Never underestimate the power of human stupidity RAH
-
What is CDC?
Never underestimate the power of human stupidity RAH
Oh sorry man, its Change Data Capture :), somehow I am able to reach it with SQL coding but if I can capture the column names only with the some settings it will be easier. Thanks in advance buddies
Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."