SQL Server Performance

TSQL to get current executing statements - SQL Server 2005

Discussion in 'Other SQL Server Blogs around the Web' started by Anonymous, Feb 12, 2008.

  1. Anonymous New Member

    Using SP_WHO or SP_WHO2 is a common way to get list of executing processes currently on the server, within SQL Server 2005 you could take advantage of DMV that lists currently-executing statements. select r.session_id ,status ,substring(qt.text,r.statement_start_offset/2, (case when r.statement_end_offset = -1 then len(convert(nvarchar(max), qt.text)) * 2 else r.statement_end_offset end - r.statement_start_offset)/2) as query_text --- this is the statement executing right now ,qt.dbid ,qt.objectid...(<a href="http://sqlserver-qa.net/blogs/t-sql/archive/2008/02/12/3428.aspx">read more</a>)<img src="http://sqlserver-qa.net/aggbug.aspx?PostID=3428" width="1" height="1">

Share This Page