What are my TRIGGER options?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bencoding
    New Member
    • Mar 2008
    • 21

    What are my TRIGGER options?

    I am writting a trigger that needs to handle INSERT, UPDATE and DELETE.

    Can I use 1 TRIGGER for this? or will I have to writemultiple tiggers? If so how would I make the distinction between if update, do this, if insert do this, and if delete do this?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by bencoding
    I am writting a trigger that needs to handle INSERT, UPDATE and DELETE.

    Can I use 1 TRIGGER for this? or will I have to writemultiple tiggers? If so how would I make the distinction between if update, do this, if insert do this, and if delete do this?
    Depending on what you want to do, I believe you can create 1 for all of these. If you want to handle each of these action differently, you're going to have to create 3 triggers.

    -- CK

    Comment

    • bencoding
      New Member
      • Mar 2008
      • 21

      #3
      Originally posted by ck9663
      Depending on what you want to do, I believe you can create 1 for all of these. If you want to handle each of these action differently, you're going to have to create 3 triggers.

      -- CK
      That's what I am trying to wrap my head around, I have been told I can put them all in one but by someone who may not be sure. This is what I would need to do for each.

      for INSERT: insert a record into another table
      for UPDATE: update a record into another table after comparing IDs
      for DELETE: delete a record from another table

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        You're going to need to create a trigger for each of those.

        -- CK

        Comment

        Working...