Options

After Update Triggers

N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
I'm working in a data warehouse that has an application resting on it. There are some functionality to the app which allows users to make changes. Some of these changes are used for auditing and KPI metrics.

I want to set getdate / timestamp values in the last update date with the after update triggers.

I have a staging environment I can test in. Just wondering if there are any one offs or gotcha I should be aware of? We have the columns already captured in the tables, so on a few of these tables I wanted to start to track the last update date. I may set a trigger to capture the user who made the update as well. (But since it's coming from a C# application I am not sure if that will track the user profile or some other generic id produced from the front end).

Comments

  • Options
    NotHackingYouNotHackingYou Member Posts: 1,460 ■■■■■■■■□□
    Just make sure you very carefully test your trigger to ensure it works the way you want for all operations and re-updates. I have used triggers in both production and staging environments and have found that sometimes they can be a performance implication. It's not intuitive but you'll be referencing the INSERTED table to get any values that have changed in your UPDATE trigger.
    When you go the extra mile, there's no traffic.
  • Options
    N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
    Hehehe that was a wild goose chase.

    So I queried the set and didn't see any updates to that column, and I didn't see any triggers set or assemblies. I assumed that their wasn't a after update trigger on those fields. Well I guess the application is controlling the input for the after insert times. I did end up finding out that there were a few records in there that had been updated.

    I found several shops control inputs from the application not the database. I'm starting to think this is common practice.
Sign In or Register to comment.