Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Trigger

Author  Topic 

avmreddy17
Posting Yak Master

180 Posts

Posted - 2008-09-23 : 12:21:53

I have a table on which I have an Audit using a trigger on UPDATE/DELETE. There is a GUI Screen in which user can load the data to a grid in the UI and make changes to any of the rows.

Some time the User Selects a record and with out changing anything , he will just save the record and this create a New Record in the Audit table.

What is the best way NOT TO insert the data into the Audit table
if there are no changes to any of the columns in a row.

Do we just have to compare all the columns in the trigger for any changes using the Inserted/Deleted tables or there is any other way

Thx

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-23 : 12:40:58
Do a chack in trigger to see if any of contents of columns in INSERTED and DELETED tables vary and insert audit record only if they vary.
Go to Top of Page
   

- Advertisement -