• Timothy

    Good points and a trigger shouldn't be considered the principal method for securing a database. Your comments about a change log - have you considered using Kimball tables? These are the Type 2, 3, 4 and 6 tables that enable you to log changes to tables in different ways (also called Slowly Changing Dimension (SCD) tables, used in SSAS too).

    This provides a way of keeping a full record of all changes (should you desire) in a tabular format rather than looking at a wall of SQL code. Upsides: comprehensive, full audit trail. Downsides: extra resources required for IO, on a heavily used table you might start seeing page IO latches increasing, and correspondingly an increase in waits.

    Plus the output is easily readable to a non-technician, in a Type 4 table a simple SELECT from the history table will give a readable, tabular output which you can port to Excel for a management summary.

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.