This post is part of a series on creating a simple audit for Microsoft Dynamics GP.
The first step in creating the audit is to create a table in the company database to hold the audited information. From the user point of view there was five pieces of information required:
- Key for the vendor EFT being amended
- User ID
- Date/Time
- Old Data
- New Data
To make reporting easier and to add an element of future proofing, I also added two other pieces of information:
- Record Type to record the type of information being audit; in this case
Vendor EFT
. - UpdateType to explicitly record whether the change was an
INSERT
,UPDATE
orDELETE
The following SQL will create a table with the table with the seven columns mentioned above:
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
CREATE TABLE ut_AZRCRV_Audit
(
RecordType VARCHAR(100)
,RecordID VARCHAR(100)
,UpdateType VARCHAR(10)
,USERID VARCHAR(150)
,ChangeDateTime DATETIME
,OldData NVARCHAR(MAX)
,NewData NVARCHAR(MAX)
)
GO