Triggers not firing

  • Can anyone tell me why a trigger would not fire when a table is updated from an app, when it fire OK when the same table is updated from query analyser? A similar trigger (generated from the same code)on another table, fires in both instances. I have checked the NOCOUNT is on, and the user has datareader, datawriter over the whole database. No error occurs, and the table is updated OK, just the trigger doesn't seem to happen. Any ideas?

    Thanks

  • No immediate insights, but are you logged on as the same user doing exactly the same query in QA and through the app? If so, then I'm stumped, otherwise this would limit the posible bugs.

    Paul Ibison

    Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

  • This is a check list which I would have to make sure if I come across something like this

    1) Check to make sure that table has the trigger for sure.

    2)Check to see whether that table is in the right db which you are testing(if you have more than one)

    My 2 cents

  • Thanks to those who replied.

    I am ambarrassed to say that the front end programmer gave me a bum steer, an I wasn't updating the table I thought I was!! DOH!!

    I should've checked instead of assuming I was given the right info.

    Sorry!!!

  • If you are using SQL 7.0 or 2000, Profiler can be your best friend. I've gotten burnt the same way and the next time after that, I had a Profile trace in hand when I cornered said developer.

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • One other thing to remember is that you can actually turn triggers off in SQL 7 and later - which can lead to a few puzzling moments if you forget to reenable when you're done!

    Andy

  • Also keep in mind when you need to know about the state of a constraint you can run the following:

    SELECT OBJECTPROPERTY(OBJECT_ID('urTriggerHere'),'ExecIsTriggerDisabled')

    1 = TRUE (Is disabled)

    2 = FALSE (Is not disabled)

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

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