Solved

Create MS SQL 2005 Changes Log

Posted on 2009-05-04
5
207 Views
Last Modified: 2012-05-06
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
0
Comment
Question by:CABHugh
  • 3
  • 2
5 Comments
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24302127
well, you can create audit trail trigger. small examples are here.

http://www.sqlhub.com/2009/03/auditing-trail-with-trigger-in-sql.html
0
 
LVL 31

Accepted Solution

by:
RiteshShah earned 500 total points
ID: 24302133
0
 

Author Comment

by:CABHugh
ID: 24302376
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
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24302382
sure, will wait for your update.
0
 

Author Closing Comment

by:CABHugh
ID: 31577907
Links provide that gave me the solution I needed.  Thank you.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question