Solved

Log events with T-SQL Trigger on MS SQL Server

Posted on 2012-03-22
2
392 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
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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 shrink a transaction log file down to a reasonable size.

707 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

19 Experts available now in Live!

Get 1:1 Help Now