Capturing all SQL Statements in my DB

  • Hi everyone,

    I have SQL Server 2005 Enterprise SP3 and I need to capture the full text of all SQL Statements, batches, RPC, Stored Procedures (did I forget anything?) that is being run in that database. I have set up a trace that includes SP:StmtCompleted under the event Stored Procedures and SQL:StmtCompleted under the event TSQL. Under each selection, I have checked the TextData column. Is this the correct setup to capture everything? Did I miss anything? Thanks in advance.

  • Running a trace is a good option. But ensure that you are running a server side trace. Here[/url] is an example.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • That's pretty much what you need. While you're there you should probably go ahead and capture duration, the database, start time, maybe the user... you can add six or seven columns without hurting performance.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks guys for your help and the quick responses.

  • Hi Adiga,

    Thanks for the link, I like your site and the articles.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply