Trigger Based Change Data capture

  • Ankush Parab

    SSC Veteran

    Points: 239

    Comments posted to this topic are about the item Trigger Based Change Data capture

  • qbrt

    SSCrazy

    Points: 2422

    This is good that you've shared this script. Thank you for that.
    I think it would also be very helpful, if you can point out the shortcomings of synchronous data change tracking solution with triggers. Especially in a highly trans/sec OLTP environment. And also how BULK operations can be affected as well. At least link some articles that have already been written on this topic. This can help with the decision making process.

  • Dan Bragg

    Old Hand

    Points: 350

    It would be good to be aware of what newer constructs you are using that will limit the backward-compatibility of your solution.  CURRENT_TRANSACTION_ID only exists in SQL Server 2016, and IIRC, "CREATE OR ALTER" was added recently too (SQL Server 2013?).  This drastically limits your target audience, unless you re-code your solution to be applicable to older versions.  Some shops won't even see 2016 until well after 2020.

  • Jeff Moden

    SSC Guru

    Points: 994695

    I could be wrong (I won't load this code to test it) but this appears to record not only data that has changed, but also records data in all of the other columns that hasn't changed and it records meta-data about each column in the table as well as some constraint meta-data, and it looks like somewhere between 300 and 400 bytes (can't tell for sure because it's a graphic rather than text) were created for the JSON "Payload" for what?  To audit that a single character was added to a single value during an update?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

    Helpful Links:
    How to post code problems
    Create a Tally Function (fnTally)

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

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