Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

audit for changed data update trigger multi-row

$
0
0

Hi,

I have a financial database on SQL 2008 that contains a budget table. A few times through-out the year the budget values will be modified to a different value. Front-end is Sage 500. Sage has some audit capability built-in but only to track changes made from its GUI.

In order to narrow in on what is happening here. I thought I would create a trigger to fire on Update. I used the trigger code mentioned by Roberthere. Obviously Ichanged the delete & put in an update. Here is my trigger code:

Create Trigger tglbudgetAuditTrigger on tglbudget

For Update

As

Insert Into audit_tglbudget

Select *, getutcdate(), SUSER_NAME()

From deleted;

Go

In testing this appears to function exactly as I had hoped.

Two questions:

1. I read a lot about, "make sure your trigger can handle multi-row updates". However as I'm pretty green at this, I don't understand...


Viewing all articles
Browse latest Browse all 4871

Trending Articles