Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 414
  • Last Modified:

Log events with T-SQL Trigger on MS SQL Server

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
hmiura
Asked:
hmiura
1 Solution
 
rtayCommented:
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
 
hmiuraAuthor Commented:
Great! Thank you!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now