Is trigger a bad solution

  • Dear,

    I fire triggers on different events. But some of my clients insist on not using trigger. Because they claim that using triggers are the worst solution. It may disable any time. But I don't get any clue.

    Please help me.

    Regards,

    Akbar

  • Only time a trigger will be disabled is if someone goes in and disables it.

    Triggers shouldn't be the first choice, if a problem can be solved without a trigger then it should be solved without a trigger. Check constraints, foreign keys, etc. If there's no other way than a trigger, then use one and make sure it's written efficiently and correctly to handle multiple rows.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank you, it helps me. I got the point.

  • shohelr2003 (3/11/2013)


    Dear,

    I fire triggers on different events. But some of my clients insist on not using trigger. Because they claim that using triggers are the worst solution. It may disable any time. But I don't get any clue.

    Please help me.

    Regards,

    Akbar

    Use the right tool for the job, and there are definitely situations where a trigger is just that.

    As Gail says, be CERTAIN to code the triggers to handle multiple rows in a single DML statement against the base table. THAT IS A CRITICAL FLAW!!!!! I know of more than one company that went out of business because they failed to do that and had bad data processing.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

Viewing 4 posts - 1 through 3 (of 3 total)

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