Tool for running but not completed queries?

  • Hi everybody! Coming with another question: Is there any tool to see in real-time "long running queries but not completed yet"? Even if I'm using sql server 2000, I use the Management Studio 2005 - I could use the included profiler to see the running queries, but it doesn't delete from the list the completed queries - that makes it very difficult to follow the "long running queries", because any second 50-60 new queries are pushed in that window, without any query being removed from that list ...

  • Have you had a look at sp_who2? This give the amount of CPU time for a given process.

    You could write a proc to put the results into a temp table and then extract long running queries.

    Jez

  • this is definitely one step forward, but how could I get the exact syntax of the statement run against the db? (not just select , awaiting and son on ...)? Don't forget I'm on sql2k .. 🙁

    (for sql2k5 solution would have been the system view: sys.dm_exec_requests..)

  • Have a look at http://sqlblogcasts.com/blogs/antxxxx/archive/2006/11/30/script-to-find-out-what-a-spid-is-doing.aspx

    Having got the spid from sp_who2, you can call the code from this webiste - the last select returns the T-SQL statement that is currently running.

    Jez

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

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