Follow

What's going on in the system right now

If you want to see what is going on in the system at the current time, then you can execute the following query

 

select des.login_name
        , der.session_id
        , der.start_time
        , der.command
        , der.wait_time
        , der.wait_type
        , det.text
from sys.dm_exec_requests der
    inner join sys.dm_exec_sessions des on der.session_id=des.session_id
    cross apply sys.dm_exec_sql_text(der.sql_handle) det
where is_user_process=1 -- THIS ONE MIGHT NOT BE IN ALL VERSIONS OF SQL
-- where session_id>=51

there are two where clauses. the first one is the most precise to identiy user queries the last one is working on all versions of SQL server.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.