Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Location
    Tel Aviv - Israel
    Posts
    40

    Unanswered: How do I know what action triggered a trigger...

    Hello

    If I have a trigger for INSERT and DELETE, how do I know what action was executed ??
    I prefer not to split the trigger to one for each action, because the the procedure for both is almost the same.

    Another question, How can I know what records were updated? I need to concatenate the ID/ID's to the SQL in the procedure.

    Thanks,

    Inon.

  2. #2
    Join Date
    Mar 2004
    Posts
    80
    If (EXISTS(SELECT * FROM INSERTED))
    Trigger for INSERT
    If (EXISTS(SELECT * FROM DELETED))
    Trigger for DELETE

    go thru BOL for more information about INSERTED,DELETED tables

  3. #3
    Join Date
    Jun 2004
    Location
    Tel Aviv - Israel
    Posts
    40
    Quote Originally Posted by theguru
    If (EXISTS(SELECT * FROM INSERTED))
    Trigger for INSERT
    If (EXISTS(SELECT * FROM DELETED))
    Trigger for DELETE

    go thru BOL for more information about INSERTED,DELETED tables
    Ok Thanks,
    But tell me, isn't it a bit spendy on resources ?

    Inon.

Posting Permissions

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