When I run the below code I got the below error
Msg 242, Level 16, State 3, Line 8
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
I want get the total of TotalOT
DECLARE @Table AS TABLE (Id INT, totalOT VARCHAR(5))
INSERT INTO @Table (Id, totalOT) VALUES (1, '114:06')
INSERT INTO @Table (Id, totalOT) VALUES (2, '56:56')
INSERT INTO @Table (Id, totalOT) VALUES (3, '74:46')
SELECT CAST((SUM (DATEPART(HOUR, CONVERT (VARCHAR, totalOT, 108))) +
(SUM(DATEPART(MINUTE, CONVERT (VARCHAR, totalOT, 108)))/60) ) AS VARCHAR(2)) + ':' +
CAST(SUM(DATEPART(MINUTE, CONVERT (VARCHAR, totalOT, 108))) - 60 * (SUM(DATEPART(MINUTE, CONVERT (VARCHAR, totalOT, 108)))/60)
AS VARCHAR(2))
FROM @Table