Results 1 to 5 of 5

Thread: Trigger fires when?

  1. #1
    Dano Guest

    Trigger fires when?


    If I update a record such as

    Update MyTable SET MyField = 'MyValue'
    where MyKey = 'Key1'

    The trigger fires .....

    If I update multiple records

    Update MyTable SET MyField = 'MyValue'
    where MyKey IN ('Key1','Key2&#39

    Does the trigger (Update) on MyTable fire more than once or once.



  2. #2
    Ray Miao Guest

    Trigger fires when? (reply)

    No, just fires once.


    ------------
    Dano at 1/19/00 11:10:26 AM


    If I update a record such as

    Update MyTable SET MyField = 'MyValue'
    where MyKey = 'Key1'

    The trigger fires .....

    If I update multiple records

    Update MyTable SET MyField = 'MyValue'
    where MyKey IN ('Key1','Key2&#39

    Does the trigger (Update) on MyTable fire more than once or once.



  3. #3
    deepak Guest

    Trigger fires when? (reply)

    The trigger will fire multiple times.
    deepak.

    ------------
    Dano at 1/19/00 11:10:26 AM


    If I update a record such as

    Update MyTable SET MyField = 'MyValue'
    where MyKey = 'Key1'

    The trigger fires .....

    If I update multiple records

    Update MyTable SET MyField = 'MyValue'
    where MyKey IN ('Key1','Key2&#39

    Does the trigger (Update) on MyTable fire more than once or once.



  4. #4
    Dan Guest

    Trigger fires when? (reply)

    According to the book that I have, the trigger will only fire once
    regardless of how many rows are modified.


    ------------
    deepak at 1/19/00 1:01:13 PM

    The trigger will fire multiple times.
    deepak.

    ------------
    Dano at 1/19/00 11:10:26 AM


    If I update a record such as

    Update MyTable SET MyField = 'MyValue'
    where MyKey = 'Key1'

    The trigger fires .....

    If I update multiple records

    Update MyTable SET MyField = 'MyValue'
    where MyKey IN ('Key1','Key2&#39

    Does the trigger (Update) on MyTable fire more than once or once.



  5. #5
    Dano Guest

    Trigger fires when? (reply)

    My books indicate that the Trigger fires once per "Operation"

    A single "Update" statement, although affecting more than 1 row, triggers one time.

    My question was driven by a logic-mistake (yes, ofcourse I make them) in my trigger. I wanted 1 row in a separate table for each row updated in a trigger. When 3 detail records were updated for same order, I wanted only one occurence in my "other" table. I changed my trigger to use a select TOP 1. This was flawed ofcourse. What I really needed to do was GROUP BY OrderNumber

    Thanks for everyones input.
    Dano.




    ------------
    Dan at 1/19/00 4:26:52 PM

    According to the book that I have, the trigger will only fire once
    regardless of how many rows are modified.


    ------------
    deepak at 1/19/00 1:01:13 PM

    The trigger will fire multiple times.
    deepak.

    ------------
    Dano at 1/19/00 11:10:26 AM


    If I update a record such as

    Update MyTable SET MyField = 'MyValue'
    where MyKey = 'Key1'

    The trigger fires .....

    If I update multiple records

    Update MyTable SET MyField = 'MyValue'
    where MyKey IN ('Key1','Key2&#39

    Does the trigger (Update) on MyTable fire more than once or once.



Posting Permissions

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