﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Ken Simmons  / Return Query Text Along With sp_who2 Using Dynamic Management Views / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 17:02:25 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>&amp;gt; a year later, ha... I ran across this thread in a search and realized I never came back and posted the version I've been using since shortly after my previous sp_who2DMV post.... This version compiles the work from KenSimmons and Grasshopper into one proc. It also accepts a parm... For example you can enter sp_who2DMV 'CPU' to sort desc by highest CPU. See comments for more.[code="plain"]USE [master]GOIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_who2DMV]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[sp_who2DMV]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROC [dbo].[sp_who2DMV]@ORDERBY VARCHAR(4) = 'SPID'/* The @ORDERBY parameter supports:                    "CPU"  CPUTime                   "IO"   DiskIO                   "USR"  Login (user)                   "HOST" HostName                   "APP"  AppNameExecution examples:EXEC sp_who2DMV       --No order by (orders by SPID by default)EXEC sp_who2DMV 'CPU' --orders by highest CPU TimeEXEC sp_who2DMV 'IO'  --orders by highest Disk IO*/ASIF ((SELECT 	CASE 		WHEN @ORDERBY in ('SPID', 'CPU', 'IO', 'USR', 'HOST', 'APP') 		THEN 1 		ELSE 0 	END) = 0)	BEGIN 		-- abort if invalid @ORDERBY parameter entered		RAISERROR('@ORDERBY parameter not SPID, CPU, IO, USR, HOST or APP',11,1)		RETURN	ENDSELECT    t.text                                               AS SQLStatement,     s.Session_ID                                         AS SPID,     COALESCE(r.status, s.status)                         AS Status,     s.login_name                                         AS Login,     s.host_name                                          AS HostName,     lw.BlkBy                                             AS BlockedBy,      DB_NAME(r.Database_ID)                               AS DBName,     r.command                                            AS Command,     COALESCE(r.cpu_time, s.cpu_time)                     AS CPUTime,     COALESCE((r.reads + r.writes), (s.reads + s.writes)) AS DiskIO,      s.last_request_start_time                            AS LastBatch,     s.program_name                                       AS ProgramNameFROM     sys.dm_exec_sessions AS s  LEFT JOIN    sys.dm_exec_requests AS r  ON    s.session_id = r.session_id  LEFT JOIN    sys.dm_exec_connections AS c  ON    s.Session_ID = c.Session_ID  LEFT JOIN    (         SELECT             l.request_session_id   AS SPID,             w.blocking_session_id  AS BlkBy        FROM             sys.dm_tran_locks as l          INNER JOIN            sys.dm_os_waiting_tasks as w          ON            l.lock_owner_address = w.resource_address    ) AS lw  ON    s.Session_ID = lw.SPID  OUTER APPLY    sys.dm_exec_sql_text(COALESCE(r.sql_handle, c.most_recent_sql_handle)) AS tWHERE s.Session_ID &amp;gt; 50ORDER BY 	CASE 		WHEN @ORDERBY = 'CPU'  THEN cast(ISNULL(r.cpu_time, s.cpu_time) as varchar)		WHEN @ORDERBY = 'IO'   THEN cast(ISNULL((r.reads + r.writes),(s.reads + s.writes)) as varchar)		WHEN @ORDERBY = 'USR'  THEN s.login_name		WHEN @ORDERBY = 'HOST' THEN s.host_name		WHEN @ORDERBY = 'APP'  THEN s.program_name	END DESC[/code]</description><pubDate>Mon, 07 Jun 2010 15:13:02 GMT</pubDate><dc:creator>digivince</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>As a .NET developer using SQL Server exclusively I have found that it is very easy to forget to close connections when using datasets with table adapters or readers.  Due to this I needed a way to find the SQL text for the IDLE connections that were orphaned by my application.  This script provided 99% of what I needed.  THANK YOU!!!!  Here is my updated script which also joins the sys.dm_exec_connections view to find the last SQL command run on the connections.  In this way I can find the code responsible for the call to SQL and add the required closes for the connections.[code]SELECT    t.text                                               AS SQLStatement,     s.Session_ID                                         AS SPID,     COALESCE(r.status, s.status)                         AS Status,     s.login_name                                         AS Login,     s.host_name                                          AS HostName,     lw.BlkBy                                             AS BlockedBy,      DB_NAME(r.Database_ID)                               AS DBName,     r.command                                            AS Command,     COALESCE(r.cpu_time, s.cpu_time)                     AS CPUTime,     COALESCE((r.reads + r.writes), (s.reads + s.writes)) AS DiskIO,      s.last_request_start_time                            AS LastBatch,     s.program_name                                       AS ProgramNameFROM     sys.dm_exec_sessions AS s  LEFT JOIN    sys.dm_exec_requests AS r  ON    s.session_id = r.session_id  LEFT JOIN    sys.dm_exec_connections AS c  ON    s.Session_ID = c.Session_ID  LEFT JOIN    (         SELECT             l.request_session_id   AS SPID,             w.blocking_session_id  AS BlkBy        FROM             sys.dm_tran_locks as l          INNER JOIN            sys.dm_os_waiting_tasks as w          ON            l.lock_owner_address = w.resource_address    ) AS lw  ON    s.Session_ID = lw.SPID  OUTER APPLY    sys.dm_exec_sql_text(COALESCE(r.sql_handle, c.most_recent_sql_handle)) AS t[/code]Thanks again!!!!!</description><pubDate>Mon, 13 Apr 2009 22:27:01 GMT</pubDate><dc:creator>bryanellis</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>I added stored proc drop and create statements, meaning you run the following to create a proc, then just exec sp_who2DMV...USE [master]GOIF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_who2DMV]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[sp_who2DMV]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROC [dbo].[sp_who2DMV]ASSELECT D.text SQLStatement, A.Session_ID SPID, ISNULL(B.status,A.status) Status, A.login_name Login, A.host_name HostName, C.BlkBy, DB_NAME(B.Database_ID) DBName, B.command, ISNULL(B.cpu_time, A.cpu_time) CPUTime, ISNULL((B.reads + B.writes),(A.reads + A.writes)) DiskIO, A.last_request_start_time LastBatch, A.program_nameFROM    sys.dm_exec_sessions A    LEFT JOIN    sys.dm_exec_requests B    ON A.session_id = B.session_id   LEFT JOIN       (        SELECT                 A.request_session_id SPID,                B.blocking_session_id BlkBy           FROM sys.dm_tran_locks as A             INNER JOIN sys.dm_os_waiting_tasks as B            ON A.lock_owner_address = B.resource_address        ) C    ON A.Session_ID = C.SPID   OUTER APPLY sys.dm_exec_sql_text(sql_handle) DWHERE A.Session_ID &amp;gt; 50;</description><pubDate>Wed, 04 Feb 2009 12:10:02 GMT</pubDate><dc:creator>digivince</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>This query does not return the last sql statement issues like inputbuffer does.  It only gives the sql for statements currently running.  Also, for stored procedures, it does not return the exec statement.  It returns the create procedure statement.</description><pubDate>Wed, 31 Dec 2008 12:21:26 GMT</pubDate><dc:creator>Shon Thompson</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Hi,it runs fine for me but the SQLStatement associated with the blocking session is NULL. The SQLStatement text for the session being blocked is ok.When i run DBCC inputbuffer(spid) against either session i get text returned.am i missing something here ?Any help welcome:)Eamon</description><pubDate>Wed, 15 Oct 2008 02:49:15 GMT</pubDate><dc:creator>EamonSQL</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Hi, I got this error too as the database compatibility level was set to 80 and I think for this table valued function to work the compatibilty level has to be 90 which you can set using this command, Exec sp_dbcmptlevel @dbname = 'yourdb', @new_cmptlevel = 90But when I execute the query after setting the compatibility level to 90, its giving another error, 'The user does not have permission to perform this action.' I am the dbo for the database.Can anyone please let me know if I have to be sysadmin for this or if I need any particular role at the server level. Please dont mind this question if it is very obvious as I am very new to SQL server database. Any suggestion would be appreciated.</description><pubDate>Fri, 11 Jul 2008 04:42:05 GMT</pubDate><dc:creator>Nabha</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>It is not process intensive.  Many people use sp_who2 to get a quick view of what is going on on the server.  This is by no means a replacement for profiler, but it does give you a quick snapshot of what is happening on the server.</description><pubDate>Thu, 10 Jul 2008 17:16:04 GMT</pubDate><dc:creator>KenSimmons</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Very nice script Ken.Just wondering if you can comment on how process intensive it may be. Would you say it's safe to use in production systems as an alternative to using SQL Profiler :crazy:</description><pubDate>Thu, 10 Jul 2008 11:17:28 GMT</pubDate><dc:creator>Alz</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Thanks John and Ken for these scripts.  Both are good and are worth keeping it handy.</description><pubDate>Thu, 26 Jun 2008 09:47:40 GMT</pubDate><dc:creator>SanjayAttray</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>I'm digging this solution. I really like to be able to filter my results, so I took the code from Dan (nice code Dan) that used the trick from Adam Machanic, and turned it into a table valued function:[code]USE [master]GO/****** Object:  UserDefinedFunction [dbo].[fn_sp_who4]    Script Date: 06/26/2008 11:31:07 ******/SET ANSI_NULLS OFFGOSET QUOTED_IDENTIFIER ONGOALTER FUNCTION [dbo].[fn_sp_who4] (@filterspid int = NULL, @filter tinyint = 1)RETURNS @processes TABLE(  spid int,      blocked int,      databasename varchar(256),      hostname varchar(256),      current_statement_parent xml,  current_statement_sub xml,  program_name varchar(256),      loginame varchar(256),      status varchar(60),      cmd varchar(128),      cpu int,      physical_io int,      [memusage] int,      login_time datetime,      last_batch datetime  )ASBEGININSERT INTO @processes    SELECT sub.*FROM(	SELECT sp.spid,    		  sp.blocked,    		  sd.name,    		  RTRIM(sp.hostname) AS hostname, 		  ( SELECT LTRIM(st.text) AS [text()]			FOR XML PATH(''), TYPE) AS parent_text,  		  ( SELECT 			LTRIM(CASE			WHEN LEN(COALESCE(st.text, '')) = 0 THEN NULL			ELSE SUBSTRING(st.text, (er.statement_start_offset/2)+1, 							((CASE er.statement_end_offset									WHEN -1 THEN DATALENGTH(st.text)									ELSE er.statement_end_offset									END - er.statement_start_offset)/2) + 1)  			END) AS [text()]			FROM sys.dm_exec_requests er 			CROSS APPLY sys.dm_exec_sql_text(er.sql_handle) AS st			WHERE er.session_id = sp.spid			FOR XML PATH(''), TYPE) AS child_text,		  RTRIM(sp.[program_name]) AS [program_name],    		  RTRIM(sp.loginame) AS loginame,    		  RTRIM(sp.status) AS status,    		  sp.cmd,    		  sp.cpu,    		  sp.physical_io,    		  sp.memusage,    		  sp.login_time,    		  sp.last_batch	  	FROM  sys.sysprocesses sp (NOLOCK) 	LEFT JOIN sys.sysdatabases sd WITH (NOLOCK) ON sp.dbid = sd.dbid	CROSS APPLY sys.dm_exec_sql_text(sp.sql_handle) AS st) sub INNER JOIN sys.sysprocesses sp2 ON sub.spid = sp2.spidORDER BY sub.spid-- if specific spid required    IF @filterspid IS NOT NULL     DELETE @processes     WHERE spid &amp;lt;&amp;gt; @filterspid        -- remove system processes    IF @filter = 1 OR @filter = 2     DELETE @processes     WHERE spid &amp;lt; 51 OR spid = @@SPID     -- remove inactive processes    IF @filter = 2     DELETE  @processes     WHERE status = 'sleeping'       AND cmd IN ('AWAITING COMMAND')       AND blocked = 0 RETURNEND[/code]Then you can run SELECT ... from master.dbo.fn_sp_who4(@filterspid = , @filter = )WHERE ... orSELECT * from master.dbo.fn_sp_who4(default,default) for the function parameter defaultsYou could also technically remove the parameters entirely since it's a table valued function after all and just use the where clause in the SELECT.It's rough, but I like it :D--John Vanda   SQL Junior DBA</description><pubDate>Thu, 26 Jun 2008 09:39:39 GMT</pubDate><dc:creator>john.vanda</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>did something similar a few months ago with the connections and sessions DMV's. it was very nice except took a lot of storage. if we did this on a regular basis it would probably run 200GB - 300GB a month for 2-3 servers. i dumped the data into a table on the local server and every 15 minutes had an SSIS job copy it to a reporting server and delete all data in the local table. </description><pubDate>Thu, 26 Jun 2008 08:55:28 GMT</pubDate><dc:creator>alen teplitsky</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Great script.  It is nice to have everything together when viewing the results and checking for blocking.Dave Novak</description><pubDate>Thu, 26 Jun 2008 07:56:35 GMT</pubDate><dc:creator>DAVNovak</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>[quote][b]sheetalsh (6/26/2008)[/b][hr]Hi Ken,It's giving error as follows:Msg 321, Level 15, State 1, Line 28"sql_handle" is not a recognized table hints option. If it is intended as a parameter to a table-valued function, ensure that your database compatibility mode is set to 90.Thanks,SS[/quote]Right Click on your database and select properties. Under the options tab the compatibility level has to be set to "SQL Server 2005 (90)" for it to work.</description><pubDate>Thu, 26 Jun 2008 07:29:44 GMT</pubDate><dc:creator>KenSimmons</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>I copied the code from the article verbatimran fine in my SQL 2005 boxes (build 3042 and 2047)I am guessing it won't run in SQL 2000Dan: your code has a WINK in it, ha ha... when it should be the closing bracket for the TABLE declaration</description><pubDate>Thu, 26 Jun 2008 07:18:50 GMT</pubDate><dc:creator>Jerry Hung</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>How close to this script can you get in SQL Server 2000? I'm stuck there for awhileThanks!</description><pubDate>Thu, 26 Jun 2008 07:18:10 GMT</pubDate><dc:creator>richard_jm</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>[quote][b]sheetalsh (6/26/2008)[/b][hr]Hi Ken,It's giving error as follows:Msg 321, Level 15, State 1, Line 28"sql_handle" is not a recognized table hints option. If it is intended as a parameter to a table-valued function, ensure that your database compatibility mode is set to 90.Thanks,SS[/quote]I get this error as well.Marc</description><pubDate>Thu, 26 Jun 2008 06:57:43 GMT</pubDate><dc:creator>Marc Bujold</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Hi Ken,It's giving error as follows:Msg 321, Level 15, State 1, Line 28"sql_handle" is not a recognized table hints option. If it is intended as a parameter to a table-valued function, ensure that your database compatibility mode is set to 90.Thanks,SS</description><pubDate>Thu, 26 Jun 2008 05:45:33 GMT</pubDate><dc:creator>sheetalsh</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>I've not tried this because the production environment I work in is stuck in 2k... but nice short too-the-point article.  Thanks.  And, I agree... I wish it worked in 2k.</description><pubDate>Thu, 26 Jun 2008 05:38:45 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>I so wish this worked with 2000</description><pubDate>Thu, 26 Jun 2008 05:24:45 GMT</pubDate><dc:creator>leea</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Here is the script.  I am not sure why it will not copy correctly from the article. When you copy the script from the article there is no space between "A.program_nameFROM".SELECT  D.text SQLStatement, A.Session_ID SPID, ISNULL(B.status,A.status) Status, A.login_name Login, A.host_name HostName, C.BlkBy,  DB_NAME(B.Database_ID) DBName, B.command, ISNULL(B.cpu_time, A.cpu_time) CPUTime, ISNULL((B.reads + B.writes),(A.reads + A.writes)) DiskIO,  A.last_request_start_time LastBatch, A.program_nameFROM    sys.dm_exec_sessions A    LEFT JOIN    sys.dm_exec_requests B    ON A.session_id = B.session_id   LEFT JOIN       (        SELECT                 A.request_session_id SPID,                B.blocking_session_id BlkBy           FROM sys.dm_tran_locks as A             INNER JOIN sys.dm_os_waiting_tasks as B            ON A.lock_owner_address = B.resource_address) C    ON A.Session_ID = C.SPID   OUTER APPLY sys.dm_exec_sql_text(sql_handle) D</description><pubDate>Thu, 26 Jun 2008 05:15:26 GMT</pubDate><dc:creator>KenSimmons</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Here's a similar one I use which uses a neat trick (credit to Adam Machanic) that returns the statement as xml so it can be clicked and opened in a new &amp;#119;indow.  Unfortunately it's xml encoded but very convenient.[code]USE [master]GO/****** Object:  StoredProcedure [dbo].[sp_who3]    Script Date: 06/26/2008 09:40:54 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROCEDURE [dbo].[sp_who3]    (     @filter tinyint = 1,     @filterspid int = NULL    )    AS    SET NOCOUNT ON;        DECLARE @processes TABLE      (      spid int,      blocked int,      databasename varchar(256),      hostname varchar(256),      program_name varchar(256),      loginame varchar(256),      status varchar(60),      cmd varchar(128),      cpu int,      physical_io int,      [memusage] int,      login_time datetime,      last_batch datetime,      current_statement_parent xml,  current_statement_sub xml)INSERT INTO @processes    SELECT	sub.*FROM(SELECT sp.spid,      sp.blocked,      sd.name,      RTRIM(sp.hostname) AS hostname,   RTRIM(sp.[program_name]) AS [program_name],      RTRIM(sp.loginame) AS loginame,      RTRIM(sp.status) AS status,      sp.cmd,      sp.cpu,      sp.physical_io,      sp.memusage,      sp.login_time,      sp.last_batch,  (    SELECT 		LTRIM(st.text) AS [text()]    FOR XML PATH(''), TYPE	) AS parent_text,    (    SELECT 		LTRIM(CASE			WHEN LEN(COALESCE(st.text, '')) = 0 THEN NULL			ELSE SUBSTRING(st.text, (er.statement_start_offset/2)+1, 					((CASE er.statement_end_offset						WHEN -1 THEN DATALENGTH(st.text)						ELSE er.statement_end_offset						END - er.statement_start_offset)/2) + 1)  			END) AS [text()]	FROM sys.dm_exec_requests er CROSS APPLY sys.dm_exec_sql_text(er.sql_handle) AS st	WHERE er.session_id = sp.spid    FOR XML PATH(''), TYPE	) AS child_textFROM  sys.sysprocesses sp WITH (NOLOCK) LEFT JOIN sys.sysdatabases sd WITH (NOLOCK) ON sp.dbid = sd.dbid		CROSS APPLY sys.dm_exec_sql_text(sp.sql_handle) AS st) sub INNER JOIN sys.sysprocesses sp2 ON sub.spid = sp2.spidORDER BY	sub.spid-- if specific spid required    IF @filterspid IS NOT NULL     DELETE @processes     WHERE spid &amp;lt;&amp;gt; @filterspid        -- remove system processes    IF @filter = 1 OR @filter = 2     DELETE @processes     WHERE spid &amp;lt; 51		OR spid = @@SPID     -- remove inactive processes    IF @filter = 2     DELETE  @processes     WHERE status = 'sleeping'       AND cmd IN ('AWAITING COMMAND')       AND blocked = 0    SELECT spid,      blocked,      databasename,      hostname,      loginame,      status,      current_statement_parent,  current_statement_sub,  cmd,      cpu,      physical_io,      program_name,      login_time,      last_batch    FROM @processes    ORDER BY spidRETURN 0;        [/code]</description><pubDate>Thu, 26 Jun 2008 02:45:06 GMT</pubDate><dc:creator>DanKennedy</dc:creator></item><item><title>RE: Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Hi,Could you please elaborate reg what you did in that query as I am not getting it?You can please provide the acript for the tables you are using so that at least we can execute the query to see the result.I am working in SQL server 2005.Thanks &amp; Regards,SS</description><pubDate>Thu, 26 Jun 2008 00:45:12 GMT</pubDate><dc:creator>sheetalsh</dc:creator></item><item><title>Return Query Text Along With sp_who2 Using Dynamic Management Views</title><link>http://www.sqlservercentral.com/Forums/Topic523842-1306-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/Administration/63144/"&gt;Return Query Text Along With sp_who2 Using Dynamic Management Views&lt;/A&gt;[/B]</description><pubDate>Wed, 25 Jun 2008 22:12:10 GMT</pubDate><dc:creator>KenSimmons</dc:creator></item></channel></rss>