Monthly Archives: November 2008

How do I figure out what query is being run by a process?

Here’s a helpful hint provided by Michael Herfkens of OpSource. If you’ve got a misbehaving process in SQL Server (hogging CPU or the root cause of excessive locking or whatever) and you want to know, “What in the world is that process doing?” you just right click on the SPID and select Details and… OH! Blank! Here’s the trick:

All you need to do to pull back the information about what is being run is to open a query window and run the following statement:


where 78 is the SPID whose activity you want to look at.


Thanks, Michael!