0
(0)

SELECT SPID = er.session_id
,DBName = DB_Name(er.database_id)
,Host = ses.host_name
,STATUS = ses.STATUS
,BlockBy = er.blocking_session_id
,CommandType = er.command
,ObjectName = OBJECT_NAME(st.objectid)
,CPUTime = er.cpu_time
,StartTime = er.start_time
,wait_type =er.wait_type
,last_wait_type =er.last_wait_type
,TimeElapsed = CAST(GETDATE() – er.start_time AS TIME)
,SQLStatement = st.text
FROM sys.dm_exec_requests er
OUTER APPLY sys.dm_exec_sql_text(er.sql_handle) st
LEFT JOIN sys.dm_exec_sessions ses
ON ses.session_id = er.session_id
LEFT JOIN sys.dm_exec_connections con
ON con.session_id = ses.session_id
WHERE st.text IS NOT NULL

Sample Output:

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.