-- what sql statements are currently running? Select start_time, ' Duration (secs) ' = datediff (Ss,start_time, getdate ()) , [Spid] = session_id, ecid, [database] = db_name (Sp.dbid), [User] = nt_username, [status] = er.status, [wait] = wait_type, [individual Query] = SUBSTRING (qt.text, ER.STATEMENT_START_OFFSET/2, (case when er.statement_end_offset = -1 then len (CONVERT (NVARCHAR (MAX), qt.text)) * 2 else er.statement_end_ offset end - &nbsP; er.statement_start_offset)/2), [parent query] = qt.text, program = program_name, Hostname, nt_domainFROM sys.dm_exec_requests erINNER JOIN Sys.sysprocesses sp on er.session_id = sp.spidcross apply sys.dm_exec_sql_ Text (er.sql_handle) as qtwhere session_id > 50 -- ignore system spids. and session_id not in (@ @SPID) -- Ignore this Current statement.and spid = 55order by 1 desc, 2
Run the above query against the target server, you can know what SQL statements is currently Running.
What SQL statements is currently Running