Store SQL statements

neoklis

Registered User.
Local time
Today, 14:39
Joined
Mar 12, 2007
Messages
80
Hi all,

Is there a way to store to a table the executed Sql statements (Insert, Update,Delete);

Thanks
 
You could implement some manual logging in all your procedures by building up log tables and inserting into them the code that was executed at the time.

Or you could buy a third party tool to interogate the transaction log

Or you could run a trace in SQL profiler (not a good idea on production systems due to performance loss)
 
Last edited:
Thank you for your post. What do you thing about triggers?
 
Triggers are ok I guess, I find them a bit overkill for logging executed statements, it's far more elegant to develop your own logging.

The trouble I find with triggers is that, sometimes people forget they are there or maybe the table has to be reloaded in a distaster recovery scenario which means you then log a load of data you don't actually need.

It is in my opinion far better to design a standard for logging data updates by creating templates for stored procedures / views ect that already contain the logging components.
 

Users who are viewing this thread

Back
Top Bottom