Need help with a trigger pls

  • Hi All,

    We have a very narrow data table where I need to capture the date a specific value is inserted into specific column. The table is a Type 2 SCD that I'm loading via SSIS and using a MERGE statement. Whenever a value of 'Y' is inserted into a specific column I need to log the Account number, Value, and date in an audit table. The original value would be NULL. Any guidance would be very much appreciated.

    I was hoping I could do it via trigger on the destination table as opposed to performing a look-up and insert in staging prior to load. Thanks!

    -DG

  • DataGuy (12/9/2015)


    Hi All,

    We have a very narrow data table where I need to capture the date a specific value is inserted into specific column. The table is a Type 2 SCD that I'm loading via SSIS and using a MERGE statement. Whenever a value of 'Y' is inserted into a specific column I need to log the Account number, Value, and date in an audit table. The original value would be NULL. Any guidance would be very much appreciated.

    I was hoping I could do it via trigger on the destination table as opposed to performing a look-up and insert in staging prior to load. Thanks!

    -DG

    We would need to know what the whole table looks like. Please post the CREATE TABLE statement for it and the Audit table.

    --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.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

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

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