Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2006
    Posts
    82

    Unanswered: Insert Trigger sometimes not firing

    hi all

    i have an issue with an insert trigger sometimes not firing.

    here is the trigger

    Code:
    CREATE TRIGGER Insert_tPABillToAddr ON [dbo].[tPA00175] 
    FOR INSERT
    AS
    
    
    INSERT into tPABillToAddr
    (
    chrJobNumber
    )
    
    SELECT chrJobNumber 
    FROM inserted
    when the user enters a new this table is to insert one column into another table. the thing is, sometimes it does not do the insert. any ideas as to why? it is a very uncommon thing, lets say once out of every 20 inserts does it fail. but it is crucial that it never fails.

    thanks

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You can be sure the trigger is firing.
    Are you sure the insert is occurring? Add a few more lines to the trigger so that data is also inserted into a log table indicating the datetime, login, and chrJobNumber of each insert.
    Keep in mind that your trigger will not fire for updates that may modify an existing chrJobNumber value.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Mar 2006
    Posts
    82
    what would be a probable cause for it not to fire? this is just an insert...i have no updates associated with it.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    While I've investigated a few cases where people thought that triggers didn't fire, I've only seen one or two cases in SQL 4.2 and SQL 6.0 where there were actually cases where a trigger should have fired, but didn't. Those were bugs in the database engine itself.

    I haven't seen that happen since the release of SQL 6.5.

    -PatP

  5. #5
    Join Date
    Mar 2006
    Posts
    82
    what if you have more than 1 insert trigger....lets say the other, for whatever reason doesnt fire, does it cause this one to cease as well?

Posting Permissions

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