Last active 1692783441

aabb revised this gist 1692783441. Go to revision

1 file changed, 1 insertion

sql

@@ -1,3 +1,4 @@
1 + --TEST
1 2 SELECT r.session_id AS [Session_Id]
2 3 ,r.command AS [command]
3 4 ,CONVERT(NUMERIC(6, 2), r.percent_complete) AS [% Complete]

aabb revised this gist 1692783373. Go to revision

1 file changed, 20 insertions

sql(file created)

@@ -0,0 +1,20 @@
1 + SELECT r.session_id AS [Session_Id]
2 + ,r.command AS [command]
3 + ,CONVERT(NUMERIC(6, 2), r.percent_complete) AS [% Complete]
4 + ,start_time AS [Start Time]
5 + ,GETDATE() AS [Current Time]
6 + ,CONVERT(VARCHAR(20), DATEADD(ms, r.estimated_completion_time, GetDate()), 20) AS [Estimated Completion Time]
7 + ,CONVERT(NUMERIC(32, 2), r.total_elapsed_time / 1000.0 / 60.0) AS [Elapsed Min]
8 + ,CONVERT(NUMERIC(32, 2), r.estimated_completion_time / 1000.0 / 60.0) AS [Estimated Min]
9 + ,CONVERT(NUMERIC(32, 2), r.estimated_completion_time / 1000.0 / 60.0 / 60.0) AS [Estimated Hours]
10 + ,CONVERT(VARCHAR(1000), (
11 + SELECT SUBSTRING(TEXT, r.statement_start_offset / 2, CASE
12 + WHEN r.statement_end_offset = - 1
13 + THEN 1000
14 + ELSE (r.statement_end_offset - r.statement_start_offset) / 2
15 + END) 'Statement text'
16 + FROM sys.dm_exec_sql_text(sql_handle)
17 + ))
18 + FROM sys.dm_exec_requests r
19 + WHERE command like 'RESTORE%'
20 + or command like 'BACKUP%'
Newer Older