Solved

Log events with T-SQL Trigger on MS SQL Server

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

838 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