SQL Server-Determine which query is taking a long time to complete

Posted by Neil Smith on Geeks with Blogs See other posts from Geeks with Blogs or by Neil Smith
Published on Thu, 10 Nov 2011 04:30:20 GMT Indexed on 2011/11/11 17:55 UTC
Read the original article Hit count: 311

Filed under:

 

Cool little trick to determine which sql query which is taking a long time to execute, first while offending query is running from another machine do

EXEC sp_who2

Locate the SPID responsible via Login, DBName and ProgramName columns, then do

DBCC INPUTBUFFER (<SPID>)

The offending query will be in the EventInfo column.  This is a great little time saver for me, before I found out about this I used to split my concatenated query script in to multiple sql files until I located the problem query

© Geeks with Blogs or respective owner