Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003

    Unanswered: Trigger question (accessing affected records)

    I'm sure this is a simple question, but I haven't had any luck finding an answer.

    With a trigger, how do I access the modified/updated/deleted rows? The point of all this is I need to a database that maintains lockout procedures to email certain people when one of these procedures gets updated/added. I want to be able to build a link that points to our webserver (the interface for the lockout db) and to do this, I need certain fields of the affected records.

    Let me know if I need to clarify anything. Any help is greatly appreciated.

    Tim C

  2. #2
    Join Date
    Oct 2003
    two special tables are created and visible from your trigger. The two tables' names are:
    1) inserted
    2) deleted

    the deleted recordset contains the data from the deleted rows for a delete trigger, the inserted contains all the rows of data being inserted,
    and for an update trigger, both inserted and deleted are used: deleted contains old values and inserted contains the new values.

    look up "inserted tables" in the online help for all the details.

    Sorry for the run-on sentence

  3. #3
    Join Date
    Jul 2002
    Village, MD
    From trigger you can check tables deleted and inserted, join them with base table and do a lot of different things. See BOL for details.

  4. #4
    Join Date
    Dec 2003
    Thanks. I'll look into these magical items. Sounds interesting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts