SQLSERVER in SP_WHO2 and usage INPUTBUFFER

First, to a large data insertions

IF OBJECT_ID('T') IS NOT NULL
DROP TABLE T
GO
CREATE TABLE dbo.T (Col1 int, Col2 char(3));  
GO  
DECLARE @i int = 0;  
BEGIN TRAN  
SET @i = 0;  
WHILE (@i < 1000000)  
BEGIN  
INSERT INTO dbo.T VALUES (@i, CAST(@i AS char(3)));  
SET @i += 1;  
END;  
COMMIT TRAN;  


Create a new query

SP_WHO2--查询到是spid为72,status为RUNNABLE

DBCC INPUTBUFFER(72)--查看这个进程执行的语句

The statement can be seen as well as the process of the process number corresponding to the execution of

Published 46 original articles · won praise 9 · views 3646

Guess you like

Origin blog.csdn.net/weixin_41896770/article/details/103017442