Solved

Log events with T-SQL Trigger on MS SQL Server

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

929 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

13 Experts available now in Live!

Get 1:1 Help Now