retrieve data when a trigger is being executed

  • How do we retrieve the contents of a row modified when a corresponding col is changed

    in an update trigger

  • Hi Sreevani

    If you are modifing a record, first Sql server delets the record and then insert a new record with the modified value. Here the deleted table contains the old values and inserted table contains the new values. Further information like how to use and all you can get from SQL Server help.

  • Inside the trigger, you can select * from inserted to see the new values, select * from deleted to see the old. You can compare these, join the tables, even join with the modified table to manipulate the data.

    Steve Jones

    steve@dkranch.net

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

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