SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)


By Aaron West,

This SQL 2005-only VBS script will show the longest-running queries on a given server, complete with graphical .sqlplan when clicked. Results go to a web page, viewed from the local machines's temp directory.

Each row of the resulting table has the session ID, the currently running statement of the batch, a link to a text file containing the full text for the SQL batch running (all statements), and a link to a page containing a .sqlplan file which loads the full query plan into SSMS when clicked. I have found it very interesting for analyzing long-running queries.

One problem: sometimes I get a "timeout" error when running this. Perhaps I need to change ADO's connection or query timeouts. I added a Connect Timeout=120, below, in case that helps.

Total article views: 330 | Views in the last 30 days: 1
Related Articles

"Query timeout expired"

"Query timeout expired".


Query Timeout

setting the query timeout at run time


Change field data type , query timeout

Change field data type , query timeout


Linked Server Query Timeout

Query timeout setting is set to 0 but still the scripts dies after 5 minutes...



Developer Claims SQL Timeouts