Trigger update on the record added or updated.

  • How do I get a trigger to act upon just this record. I have read up a little on triggers but cant seem to find this. Sorry if its really stupid question.
  • What do you mean by just this record?

  • Basically I need the ID of the record(s) that was just inserted or updated (Trigger is for both).
     
    Is SELECT * FROM Inserted ,how to get the records just added?
     
    Similarly how would I get the records either inserted or updated.
     
    Then I can do other things with the record IDs affected.
     
    Thanks
  • WHERE CURRENT OF

    ???

     


    N 56°04'39.16"
    E 12°55'05.25"

  • Can you tell us the rest of the tasks, that way we code only once .

  • Its OK - The list of records inserted or updated is in the inserted table. So FRom here I can do the rest.
     
     
    Thanks
  • How'z that work Peter... sounds interesting but also sounds like it might be a cursor and I'm thinking I know you better than that...

    [EDIT] Oh yuck!!  It IS used with a cursor! 

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 7 posts - 1 through 6 (of 6 total)

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