Similarly as Watches, the Lookups feature allows the ApexSQL Trigger report to show a meaningful value from a related SQL Server database table, along with the value of the field that was audited. A more human-readable value can be shown in the audit reports, for example “111” (customer’s ID number) versus “John Smithson” (customer’s actual name).
To examine how to achieve this, the previously described Clients table will be used, along with the Invoices table, which consists of the following columns:
Now, if someone changes the “owner” (Client field) of the particular invoice, it will be shown in the audit report as:
Indicating that the Client field has changed the value from “111” to “222”. Not much of an information for the reader of this report.
However, if the Lookups feature is set up properly, the output from the installed SQL Server database trigger will be something like this:
Here is how to accomplish this; The Lookups panel can be accessed from the View tab, in the Panels panel section, just like the Watches:
If ‘Owner name: ‘ + {table}.Name + ‘ / ID: ‘ + LTrim(Str({table}.ClientID)) is used as an expression, the output will be exactly what is needed
This is just an example of what can be achieved with just a few clicks to add powerful customization to your trigger based SQL Server auditing.
© ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center