SQL server profiler

  • how can we capture each statement executed inside a stored procedure by sql profiler to tune it. i am able to capture just the call to the execute procedure statement in profiler but not each of the statments in the sql profiler..can this be done ?

  • I don't know if you can do it in Profiler, but I know traces can do it, so I assume Profiler can (since it's just a GUI for creating a trace).

    Event IDs 44 and 45 are the ones for statements inside procs.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • This is certainly possible.

    working from memory here on the event names but under TSQL look for SQLStmtStarting and SQLStmtCompleted.

    Beware you are likely to get a lot of output compared to just tracing stored proc calls.

    If you are going to do this for any length of time and it is on a production box do it as a server side trace.

    ---------------------------------------------------------------------

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

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