I have the below query.
select cast(dateadd(minute, datediff(minute, TimeIn, TimeOut), 0) as time(0) )
I get the results from two columns in th
Expanding on Justin's answer. This allows for situations where hours is larger than 2 digits.
declare @time varchar(50) = '102:47:05'
SELECT cast(right(@time,2) AS int)+
cast(left(right(@time,5),2) AS int)*60+
cast(left(@time,len(@time)-6) AS int)*3600 AS seconds,
(cast(right(@time,2) AS int)+
cast(left(right(@time,5),2) AS int)*60+
cast(left(@time,len(@time)-6) AS int)*3600)/60.0 AS minutes
Result:
seconds minutes
----------- ---------------------------------------
370025 6167.083333