Preserve CDC data when disabling and re-enabling CDC

  • Hello,

    this is my first post here, so please be gentle đŸ™‚

    i have to recreate a clustered index on the pk (ID int) to be DESC

    in order to do that, i have to drop and create

    the table has cdc enabled - so, in the script, i've included sys.sp_cdc_disable_table and sys.sp_cdc_enable_table

    but i don't want to loose data from the cdc table (cdc.dbo_MyTable_CT)

    how can i do that?

    it is possible to save the data into a temp table and then get the data back from there?

    Thanks and regards,

    R

  • that's a very commun escenario. You need to save data in other table before disable cdc. Last year I have that problem and I give to user a view, and that view was an union between old table and cdc.

    -

    Lic. Andrés M. Aiello

    DBA MSSQL - Oracle

    http://aiellodba.blogspot.com/

  • hi and thx for the prompt answer

    this is exactly as i did

    i encountered some problems with insert into cdc select * temp

    but i wrote the exact names of the columns and all was allright

  • if you don't know structure you can use this:

    SELECT * INTO NewTable

    FROM cdc.dbo_OldTable_CT

    -

    Lic. Andrés M. Aiello

    DBA MSSQL - Oracle

    http://aiellodba.blogspot.com/

Viewing 4 posts - 1 through 4 (of 4 total)

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