SQLConfiguration SQLConfiguration


Monitoring SQL  «Prev 

Output from dbccinput buffer in SQL-Server


What is DBCC INPUTBUFFER ?

It is a command used to identify the last statement executed by a particular SPID. You would typically use this after running sp_who2

How to use

For example, I have just run run sp_who2 and identified that my lead blocker is SPID number 54 so I would run as follows:



DBCC INPUTBUFFER(54)
Here is a simple demonstration. In a new query window run thisview sourceprint?
1 BEGIN
2UPDATE Orders SET Amount = 500 WHERE OrderID = 1;
Now in a second query window run this
UPDATE Orders SET Amount = 200 WHERE OrderID = 1; 
Now run sp_who2 to identify the lead blocker followed by DBCC INPUTBUFFER using the lead blocker SPID.
Here are my results with the column "EventInfo" providing the detail that I need on the T-SQL which is causing the problem. It is possible to copy and paste the code into a query window for analysis.