Logging all SQL statements

  • How can I log all SQL statements?

    Sorry if this is a basic question; I've searched around and turned up disappointing results.

    Thank you,

    Jonathan Hayward

    Jonathan's Corner: A Glimpse into Eastern Orthodox Christianity[/url]

  • Very best way to log all calls to a database is through SQL Profiler (also called Trace).

    "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

  • you can also log all sql statements through enabling C2 audit. But it will hinder badly performance of your Server and create a big file on your disk.

  • Thanks. I'll explore both of those.

    Jonathan Hayward

    Jonathan's Corner: A Glimpse into Eastern Orthodox Christianity[/url]

  • I'm looking at Profiler and am not quite sure I have the picture right.

    I am accessing the database through a client program. I started a trace, started the client and did a couple of things through the client that appear to cause persistent change in the database. However, I saw a total of three statements listed. This was under a more or less default configuration, and when I explored, Profiler seemed set to log basically all events but those it generated itself.

    These things don't seem to add up. Do you know what might be missing?

    Jonathan Hayward

    Jonathan's Corner: A Glimpse into Eastern Orthodox Christianity[/url]

  • It's not quite clear from what you said. Do you think profiler's showing too many events, or too few?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 6 posts - 1 through 6 (of 6 total)

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