Google
Web tarasdom.com

 

Microsoft SQL server gotchas


Query to find long running transactions

select spid,cmd,status,loginame,open_tran,
	datediff (s,last_batch,getdate()) as [Waittime (s)]
from master..sysprocesses p 
where	open_tran > 0 and spid > 50 
	and datediff (s,last_batch,getdate()) > 30 
	and exists 
	( select * from master..syslockinfo 
	 where req_spid=p.spid and rsc_type <>2
	)

Books

©
Page was modified 04.09.2007