title: SQL Queries running with User ID/Login
body: <p>Is there a way in SQL server to see what queries users are running? I have found info on how to see what queries are running but I am not able to see what user ID or login is running what. I am new to running queries against [sys.] and any help would be greatly appreciated.</p>
  
  <pre><code>    SELECT
            r.start_time [Start Time]
          , session_ID [SPID]
          , DB_NAME(database_id) [Database]
          , SUBSTRING(t.text,(r.statement_start_offset/2)+1, 
                       CASE WHEN statement_end_offset=-1 OR statement_end_offset=0 
                       THEN (DATALENGTH(t.Text)-r.statement_start_offset/2)+1 
                       ELSE (r.statement_end_offset-r.statement_start_offset)/2+1 
                       END) [Executing SQL]
          , Status
          , command
          , wait_type
          , wait_time
          , wait_resource
          , last_wait_type
  FROM
            sys.dm_exec_requests r
            OUTER APPLY
                      sys.dm_exec_sql_text(sql_handle) t
  WHERE
            session_id &gt; 50 --
  ORDER BY
            r.start_time
  </code></pre>
  
  <p>but it doesn't show me the login ID. 
  At times I want to identify who is running what.</p>
  
  <p>EDIT: Source for above query <a href="http://www.sqlmatters.com/Articles/See%20what%20queries%20are%20currently%20running.aspx" rel="nofollow">http://www.sqlmatters.com/Articles/See%20what%20queries%20are%20currently%20running.aspx</a> </p>