how to get the updated row info in triggers?

  • Hi All,

    I have a main table and wants to update audit table when the main table rows gets updated. I am unable to find how to access info on which row was updated. All that i need is an Id of the main table so that i can use it in the trigger to update the audit log.

    I know that we can not pass arguments to the triggers. Please suggest me a solution.

    Thanks,

    Suresh

  • You're looking for the inserted and updated tables. In an update, inserted will contain the new values and deleted will contain the old values. Only the rows affected by the update will be in them.

    p.s. Please post in the correct forum next time.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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