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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Updating changes to two tables using T-SQL

Author  Topic 

Billkamm
Posting Yak Master

124 Posts

Posted - 2006-01-24 : 15:11:47
I have a webform contains a list of documents and information about them. What would be the best way to update any changes back to the database where I would need to log each change into an audit table as well.

For example:


document changed
A Yes
B No
C Yes


I would need to take this information and update the documents table with the changes from A and C, but ALSO would need TWO entries in my audit log table. One for A and one for C. Is there a quick way to do this or will I need to use loops and/or cursors? I'm trying to find a way that won't kill my performance. Thank you.

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2006-01-24 : 15:41:42
Put a trigger on your table that inserts log entries into your log table.
Go to Top of Page
   

- Advertisement -