• Hello,

    Thank you for providing the article, it was certainly interesting.

    However, I have to caution that I would not really advise using triggers like this. For one thing, as the article itself alludes, triggers may not be the most effective mehtod. If you wanted to ensure someone did could not delete records, it would be much better to deny them delete permissions.

    Additionally, triggers create "hidden code", code that can run when developers do not expect it to. This can cause unexpected errors as well as make it difficult to diagnose performance issues. For that reason, I generally recommend using triggers only where no other solution fully covers the need and documenting them carefully.

    There is one use for triggers I have encountered that does justify the "hidden code" dangers and has security implications, at least tangentially. Triggers are very useful for creating a thorough change log regardless of how the change is made. Such change logs have often been useful for me when the end users need a history of the table. But they can also be useful in diagnosing problems, including problems that are caused by people with malicious intent. But of course even in that case someone with the right security permissions can disable the trigger, make their change, and reenable it, so logging should not provide a false sense of security.

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/