Possible Duplicate:
Are database triggers evil?
There is lot of negative information on database triggers, just want to get the community’s take on when is it good vs bad.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think they’re OK when they are used to populate a separate, one-off set of tables for things like logging, aggregation etc. for security or creating metadata for example.
When you start altering your “live” data or “looping back” into your biz info tables, that’s when they become evil and unwieldy. They are also utterly unnecessary for this. There is nothing that a trigger does that a stored proc cannot do.
I feel like they are SQL’s evil equivalent to GOTOs in programming languages. Legal, but to be avoided unless absolutely necessary, and they are NEVER absolutely necessary.