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
 SQL Server Administration (2000)
 What is the best way to audit sql transactions to a table?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-08-14 : 08:12:11
Miles writes "I created an trigger (on insert and update) on a table that uses the new fn_get_sql function that comes with SQL Server 2000 SP3. I use it to record who performed what transaction and when they did it. When I used DBCC INPUTBUFFER, it worked fine, but I was limited to the first 255 characters of the command, which prevented me from seeing the critical parts, like the where clause! When I modified the trigger to use fn_get_sql, all I ever see is the entire text of the create trigger command. Maybe I should use an entirely different approach. I'm open to ideas.

Thanks very much in advance for your help!

Miles"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-08-14 : 08:41:01
Your best bet is to compare the INSERTED, DELETED and target table in the trigger dml to figure out what is new/changed and then write that to your audit table.

Jay White
{0}
Go to Top of Page
   

- Advertisement -