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

 

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

Print | posted on Wednesday, November 9, 2011 4:30 PM

Feedback

No comments posted yet.

Your comment:





 

Copyright © Neil Smith

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski