LadyBird0 / SQL

0 stars 0 forks source link

Check all the jobs and theirs statuses #1

Open LadyBird0 opened 6 years ago

LadyBird0 commented 6 years ago

select r.session_id AS 'SID', r.start_time AS 'Running since', s.host_name as Host, substring (s.login_name,6,30) As 'User', r.status, r.blocking_session_id AS 'Blkd By', r.wait_type, r.percent_complete, r.total_elapsed_time, r.reads, r.writes, r.logical_reads, t.text, p.query_plan, r.transaction_isolation_level from sys.dm_exec_requests r join sys.dm_exec_sessions s
on r.session_id = s.session_id cross apply sys.dm_exec_sql_text(r.sql_handle) t cross apply sys.dm_exec_query_plan(r.plan_handle) p where database_id = db_id('DBNAMESTR')