How to add new column in a CDC(Change Data Capture) script for a table

  • we have a requirement where we want to enable CDC on newly added columns of table, but I cannot disable CDC and enable it again. It should not affect the existing data in an table. 

    Regards,
    Ram

  • sram24_mca - Tuesday, November 20, 2018 3:11 AM

    we have a requirement where we want to enable CDC on newly added columns of table, but I cannot disable CDC and enable it again. It should not affect the existing data in an table. 

    Regards,
    Ram

    You can create two capture instances for a table. So in your case, alter the table then create a new capture instance with a new name. You can execute sys.sp_cdc_help_change_data_capture to get the current capture instance name.
    After you have the second instance running, you can copy the data from the original capture instance to the new cdc tables and then delete the old capture instance. This article has a demonstration of how to do it:
    Understanding how DML and DDL changes impact Change Data Capture in SQL Server

    Sue

  • We have followed the steps and executed. Now we are getting below error message when we ran newly added capturing instance. We wrote the Table Valued function

  • An insufficient number of arguments were supplied for the procedure orfunction cdc.fn_cdc_get_net_changes_ ...

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply