Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Get modified column names from Change Data Capture

Get modified column names from Change Data Capture

Scheduled Pinned Locked Moved Database
helpannouncement
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    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."

    M 1 Reply Last reply
    0
    • I indian143

      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."

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      What is CDC?

      Never underestimate the power of human stupidity RAH

      I 1 Reply Last reply
      0
      • M Mycroft Holmes

        What is CDC?

        Never underestimate the power of human stupidity RAH

        I Offline
        I Offline
        indian143
        wrote on last edited by
        #3

        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."

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups