I have a variable of type
TIME, I need to divide the time of this variable by 2.
My SQL code:
DECLARE @TEMPO AS TIME = '01:31:00' SELECT (@TEMPO / 2 ) AS RESULT --the result should be: 00:45:30
SQL Server however throws an error:
Operand type clash: time is incompatible with int
Every help is welcome!
Just another option is to convert the time to
datetime and then to
float, and then divide by two.
DECLARE @TEMPO AS TIME = '01:31:00' Select convert(time,convert(datetime,convert(float,convert(datetime,@Tempo))/2))