February 29, 2012 at 6:33 am
sqlnaive (2/29/2012)
select a.spid, b.text from sys.sysprocesses a cross apply sys.dm_exec_sql_text(a.sql_handle) bThis is the query I'm using. This is giving me even those sessions which are closed in query analyzer.
May be this can help:
SELECT SPC.[spid],DEST.[text]
FROM
sys.sysprocesses SPC CROSS APPLY sys.dm_exec_sql_text(SPC.[sql_handle]) DEST
WHERE
LOWER(SPC.[status]) <> 'sleeping'
AND
UPPER(SPC.cmd) NOT IN ('AWAITING COMMAND','LAZY WRITER','CHECKPOINT SLEEP')
February 29, 2012 at 7:14 am
Isn't sys.sysprocesses marked for deprecation?
I use sys.dm_exec_requests/connections/sessions (whichever's appropriate) in its place.
February 29, 2012 at 7:46 am
Gazareth (2/29/2012)
Isn't sys.sysprocesses marked for deprecation?I use sys.dm_exec_requests/connections/sessions (whichever's appropriate) in its place.
Yes, It is marked for deprecation. Most of us have already started using sys.dm_exec_sessions & sys.dm_exec_requests instead. However, I believe that OP is already aware about that.
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply