Solved

Log events with T-SQL Trigger on MS SQL Server

Posted on 2012-03-22
2
405 Views
Last Modified: 2012-03-22
I need to log all MS SQL events (insert, delete and update) for all tables. For example, if the table PRODUCTS is updated I need to record all the fields that where updated and who did it. It would be something like this:

DATE/HOUR - TABLE (PRODUCTS) - FIELD (PRICE) - VALUE AFTER UPDATE (U$10) - USER (WHO DID IT)

Of course this may be recorded in another table or TXT file. Is it possible with a trigger?
0
Comment
Question by:hmiura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
rtay earned 500 total points
ID: 37753861
Yes, trigger is what you would use.  

This should give you some ideas to get started.

http://gallery.technet.microsoft.com/scriptcenter/Create-Audit-Table-and-5cd69d5d
0
 

Author Closing Comment

by:hmiura
ID: 37754077
Great! Thank you!
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

615 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