Skip to content

Instantly share code, notes, and snippets.

@thzinc
Last active December 16, 2015 00:28
Show Gist options
  • Save thzinc/5347317 to your computer and use it in GitHub Desktop.
Save thzinc/5347317 to your computer and use it in GitHub Desktop.
T-SQL query to get information from SQL Server 2008 (and R2) about all running requests, along with percentage of completion. Originally got it from a blog somewhere... Can't remember whose it was.
SELECT
r.session_id,
t.text,
r.status,
r.command,
database_name = DB_NAME(r.database_id),
r.cpu_time,
r.total_elapsed_time,
r.percent_complete
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment