Solved

Create MS SQL 2005 Changes Log

Posted on 2009-05-04
5
194 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now