Leighton21
Technical User
Hi All,
I have a query which I am trying to get to work it is as follows
Select TIME
From TIMES
WHERE convert(datetime, runtime, 108) < '12:00'
unfortunately this is an existing DB and the runtime is a varchar with data that looks like the following
11:23
23:45
etc
one of the values is 24:00 (which is not actually a valid time. And since the user still wants to use the 24:00 I am at a cross road.
I tried something like
Select TIME
From TIMES
WHERE convert(datetime, (select case runtime when '24:00' then '00:00' ELSE runtime END from From TIMES), 108) < '12:00'
but it this still comes back with a error about conveeting a varchar to datetime being out of range.
Does anyone please have any suggestions?
I have a query which I am trying to get to work it is as follows
Select TIME
From TIMES
WHERE convert(datetime, runtime, 108) < '12:00'
unfortunately this is an existing DB and the runtime is a varchar with data that looks like the following
11:23
23:45
etc
one of the values is 24:00 (which is not actually a valid time. And since the user still wants to use the 24:00 I am at a cross road.
I tried something like
Select TIME
From TIMES
WHERE convert(datetime, (select case runtime when '24:00' then '00:00' ELSE runtime END from From TIMES), 108) < '12:00'
but it this still comes back with a error about conveeting a varchar to datetime being out of range.
Does anyone please have any suggestions?