Fizzgig Fizzgig - 1 month ago 10
SQL Question

Finding the time between datetime values in metric format

I want to have a 'Duration' field in the format hours.minutes but I would like the minutes to be 'metric' (by which I mean in decimal format).
For example, the difference between

'2016-11-02 12:00:00.000'
and
'2016-11-02 13:45:00.000'
would be
1.75
.
Thanks!

Answer
SELECT CAST(DATEDIFF(MINUTE, '2016-11-02 12:00:00.000', '2016-11-02 13:45:00.000')/60.0 AS DECIMAL(5,2))