Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Tracking data changes in SQL 2005 using a trigger Expand / Collapse
Author
Message
Posted Monday, February 23, 2009 10:29 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 26, 2009 6:33 AM
Points: 6, Visits: 17
I read that to track data changes in SQL 2005, I'll need a trigger. I need help creating the trigger and having it work.
Example: I need to track data changes on table 1, columns A, E and F
I need to know what the change was, who made the change and the date and time the change was made.

Is there another easier way to track data changes??
Post #662767
Posted Monday, February 23, 2009 10:39 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 11:24 AM
Points: 32,781, Visits: 14,942
A trigger will do this, or you can read the log later if you buy a tool.

http://www.sqlservercentral.com/articles/Security/sqlserverauditingpart1/1451/







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #662776
Posted Monday, February 23, 2009 11:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 26, 2009 6:33 AM
Points: 6, Visits: 17
I would need the T-SQL script for creating the table that will hold info on data changes and creating the trigger using the table and columns I gave in the example.

Post #662799
Posted Monday, February 23, 2009 11:27 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Monday, April 14, 2014 1:34 PM
Points: 15,442, Visits: 9,588
Check out these articles, and the discussions. Plenty of sample code to set up audit logging.

http://www.sqlservercentral.com/articles/Auditing/63247/
http://www.sqlservercentral.com/articles/Auditing/63248/


- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #662813
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse