Link to home
Start Free TrialLog in
Avatar of Phil
PhilFlag for United States of America

asked on

How to track SQL Server field value changes using triggers or any other utility

My client wants to audit changes to a date field (TargetDate) in a SQL Server 2012 table as dates seem to be changing without any direct entries from users. I am investigating using triggers to capture the OrderNumber, DateValue, and a few other pertinent fields before being updated and after. My understanding is that SQL Server does not support an "Before Update" trigger so I don't know how to find the value before being updated. If possible, I'd also like to add the workstation ID that initiated the date change as well.
SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phil

ASKER

Wonderful, do you have any code samples that will make it easy for me to insert this data into an audit table???   Thanks!
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phil

ASKER

Fantastic, it works. Is there a way to capture the computer name that initiated the change?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phil

ASKER

I am thrilled with how this worked out. Scott, you are the very best and I appreciate it very much.. Thank you, thank you, thank you!!