SQL Server Performance

Who Updated my row??

Discussion in 'ALL SQL SERVER QUESTIONS' started by MrVision, Apr 18, 2012.

  1. MrVision New Member

    I have a table that holds config information and an unknown source is updating the values. If I place a trigger on the table and write a history row the trigger is identified as the history row creator. How can I capture the object id that updated the config row??
  2. FrankKalis Moderator

    If the update happens via a stored procedure call, you can use the @@PROCID variable to get the object_id.
  3. MrVision New Member

    inside the trigger the @@procid is the object_id of the trigger.
  4. FrankKalis Moderator

    Aah, yes, that's true. Sorry! If you're in control of the procedure, you might then be able to set CONTEXT_INFO() and evaluate its value inside the trigger.
  5. Madhivanan Moderator

    How about using app_name() to know the source and then drill down?

Share This Page