Quantcast
Channel: kristofdba – kristof dba
Viewing all articles
Browse latest Browse all 26

Time difference between 2 columns

$
0
0

Use this to calculate time diff in seconds between two values. This is used to check how long our index maintenance takes in detail !

<code>

select L.id, L.DatabaseName, L.Objectname,
min(StartTime) start_time,
max(EndTime) end_time,
datediff(second, min(Starttime),max(Endtime)) elapsed_sec
from [dbo].[CommandLog] L
group by L.id, L.DatabaseName, L.ObjectName
order by Objectname

</code>



Viewing all articles
Browse latest Browse all 26

Trending Articles