I need to create a column that will store hours bigger than 24. For example '25:00:00', '129:23:12', etc).
That column will be used to perform calculations between datetime intervals: ‘time’.
I was trying
SELECT CAST((CAST(CAST(RIGHT('107:37', 6) as datetime) AS FLOAT))/(207.160) AS DATETIME)
if it
below '23:59' instead of '107:37' working fine.
'107:37' give error:
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
Just store the value as a datetime data type. You can do mathematical calculations on datetime data types, such as +, -, SUM, MIN, MAX, etc, and you can use DateDiff and DateAdd as well. The only tricky bit you’re going to have is in displaying the value as HHHH:mm:ss. You can do that easily enough, though: