I'm trying to to created a triggered action that populates and Audit Log Summary Table (1 record per event - ) and an Audit Log Details Table ( 1 record per changed Field/Column).
Workflow is upon Insert or Update to Orders Table want to Log Changes. Trying to keep Log tables as simple as possible. Assume following Table Structures:
Orders Table:
Accession ID (Primary Key)
Editable fields 1
Editable fields 2
Editable fields 3
Editable fields 4
Editable fields 5
Last Modified - Timestamp
Last Modified by - User Stamp
Audit Log Summary Table:
Summary ID (Primary Key)
Accession ID(Foreign Key from Orders)
Modified by User
Modified Date
Change Type (I, U, D)
Audit Log Details Table:
Audit Log Detail ID (Primary Key)
Summary ID (Foreign Key from Summary Table)
Column Name( Field that changed in orders table)
Old Value
New Value
I know how to create the trigger to insert Accession ID, Modified by User, and Modified Date into Summary table upon Insert, Update, or Delete. I'm not certain how to stamp the change type field - based on Insert, Update or Delete.
What I'm really struggling with is next step. For each event, how do I identify Fields that changed, and insert changes into details table? An would I be nesting this into original trigger in Orders table, or creating a new trigger in Summary Table?
Pasting 1st part of trigger for reference. Any help or guidance greatly appreciated...
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
kgraham2121
Hi,
I'm trying to to created a triggered action that populates and Audit Log Summary Table (1 record per event - ) and an Audit Log Details Table ( 1 record per changed Field/Column).
Workflow is upon Insert or Update to Orders Table want to Log Changes. Trying to keep Log tables as simple as possible. Assume following Table Structures:
Orders Table:
Audit Log Summary Table:
Audit Log Details Table:
I know how to create the trigger to insert Accession ID, Modified by User, and Modified Date into Summary table upon Insert, Update, or Delete. I'm not certain how to stamp the change type field - based on Insert, Update or Delete.
What I'm really struggling with is next step. For each event, how do I identify Fields that changed, and insert changes into details table? An would I be nesting this into original trigger in Orders table, or creating a new trigger in Summary Table?
Pasting 1st part of trigger for reference. Any help or guidance greatly appreciated...
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.