My table:
When I convert it to time, it fails while selecting from table:
But, when I test it in string, then there is no issue. What is the problem? I don't know.
My table:
When I convert it to time, it fails while selecting from table:
But, when I test it in string, then there is no issue. What is the problem? I don't know.
I think you have new line in your time column. Please use substring to get exact time.
select CONVERT(time, substring(timout, 1, 5), 104)
from tbl_test
Convert will create problem when time is null or invalid so use Len function.
select CONVERT(time, substring(timout, 1, 5), 104)
from tbl_test
where len(TimOut) > 4
select CONVERT(time, substring((CASE TimOut WHEN '0' THEN '00:00' ELSE TimOut END),1,5),104) from tbl_test