web analytics

MS SQL: long running queries

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)

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.