November 16, 2005 at 10:08 am
I would like to log every SQL query, success and failure, that hits my
database. Is this possible?
Thanks.
November 16, 2005 at 3:56 pm
The only method I know of that would allow you to do this and have it readily available to view would be to run a constant SQL Profiler trace that is peared down to only view information you require. This will, of course, add a level of overhead to your system. There may be other 3rd party tools that you could use instead of Profiler, but all attempts at doing what you want will add overhead. I recommend that you do some fairly comprehensive performance testing/benchmarking in a test environment prior to implementing anything of this nature in a production environment.
November 16, 2005 at 6:55 pm
I have a set of stored procedures that define at trace that writes to a file. This is usually used for record SQL for performance problem investigation, but you should be able to modify for your particular needs.
In the meantime, use SQL Profiler to set up the trace for the events, columns and filters that you need and then use the menu item to pick File --> Save As --> SQL Script.
The resulting file will then contain the SQL statements to define the events, columns and filters . Then you can replace what exists in the provided sps with your needs.
SQL = Scarcely Qualifies as a Language
November 16, 2005 at 9:04 pm
Hey thanks guys, that will work. The overhead is temporary, this is a 'boss lost the source code' problem, so I just have to run the trace long enough to see what is being done to the database.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply