DBCC INPUTBUFFER (spid)

Posted on Updated on

DBCC INPUTBUFFER (spid) shows the last statement executed for a given SPID. This statement is mostly used for troubleshooting purposes to determine the exact command a particular SPID is running or have executed. To run this command you must be a member of the sys admin fixed server role, or have VIEW SERVER STATE permission (if SQL 2005+).

To get the SPID you can use sp_who2 to find out which SPID is taking a lot of resources.

To execute, simply replace the SPID below with the one you want to spy on.

Leave a Reply

Your email address will not be published. Required fields are marked *