Last active
August 29, 2023 01:59
-
-
Save kmatt/809902 to your computer and use it in GitHub Desktop.
SQL Server execution status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT R.session_id, DatabaseName = db_name(R.database_id), S.text, R.Status, R.Command, | |
R.percent_complete, | |
CAST(CAST(DATEADD(mi, R.total_elapsed_time/60000.0, 0) AS TIME) AS CHAR(5)) runTime, | |
CAST(CAST(DATEADD(mi, R.estimated_completion_time/60000.0, 0) AS TIME) AS CHAR(5)) remain, | |
R.reads, R.writes, R.cpu_time, R.status, R.wait_type | |
FROM sys.dm_exec_requests R | |
CROSS APPLY sys.dm_exec_sql_text(R.sql_handle) S | |
WHERE R.session_id <> @@SPID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment