Link to home
Start Free TrialLog in
Avatar of CABHugh
CABHugh

asked on

Create MS SQL 2005 Changes Log

I wish to create a changes log for many of my tables in a MS SQL 2005 DB.

I will shortly be allowing our 26 shops access to our main database.  They will be able to edit data.  Because of this I need a simple log of what they change!  I would like to record to a single table the following data:
Table Name, ID of Record Changed, Field Changed, Old Value, New Value, Date/Time, User.

I will then display this information to Managers & Supervisors in a simple Access DB form so we can see what they are actually doing.

Has anyone got an example of the code I require.  I'm a relative beginer with SQL so a simple Copy/Paste solution would be great!

I've seen various ways of doing this type of thing but could really do with
Avatar of RiteshShah
RiteshShah
Flag of India image

well, you can create audit trail trigger. small examples are here.

http://www.sqlhub.com/2009/03/auditing-trail-with-trigger-in-sql.html
ASKER CERTIFIED SOLUTION
Avatar of RiteshShah
RiteshShah
Flag of India 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 CABHugh
CABHugh

ASKER

Hi

Thanks for these.  I 've just had a look and am going to test http://www.codeproject.com/KB/database/AuditTrailGenerator.aspx first.  I know that this will create plenty of bloat but it really does give me a simple solution to restore data as I choose (if required!).

I'll let you know how I get on.

Regards
sure, will wait for your update.
Avatar of CABHugh

ASKER

Links provide that gave me the solution I needed.  Thank you.