Profiler/sp_executesql

  • I've got a 2000 SP4 server whose disk i/o is going through the roof.  I did my DBA thing and ran Profiler and I found the culprits.  Well, kind of.  It appears to be some third party software that is doing some table scans - 100 million records at a time.

    But here is the problem.  The text in Profiler just says, "sp_executesql 1" or "sp_executesql 2" for these nasty queries.

    My question is "what is the '1' or '2'?  Is that a parameter?  Where is the rest of the sql?  Doesn't sp_executesql usually require a sql statement to follow?

    Any help would be much appreciated...

  • Look for text of "sp_prepare" shortly before those sp_execute statements... what happens is (if I recall) sp_prepare readies the SQL and stores it temporarily with a numeric handle (that's your 1, 2, etc...). Then sp_executesql is called to execute it.

  • I had just figured that out!  Thank you much though...

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

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