Quantcast
Channel: Question and Answer » transaction
Viewing all articles
Browse latest Browse all 35

Why are SELECT queries in sleeping status holding open transactions

$
0
0

Using sp_WhoIsActive, I see that I have a lot of processes in a “sleeping” status, several for hours. I am not sure of the cause and am still troubleshooting (timeout? bad code with uncommitted transaction?).

Using the query below, I noticed that all of these open transactions are SELECT queries in a “sleeping” status. Why would a SELECT open a transaction? Could these be in the middle of a stored procedure somewhere, and the [TEXT] field is only showing the last statement in the procedure that was executed? There is no wait_info on any of the open transactions.

 SELECT [TEXT] as SQLcode 
 FROM SYS.SYSPROCESSES SP
 CROSS APPLY SYS.DM_EXEC_SQL_TEXT(SP.[SQL_HANDLE])AS DEST WHERE OPEN_TRAN=1

Viewing all articles
Browse latest Browse all 35

Trending Articles