>Select Current_TimeStamp - Cast('00:20:00' as Time) From rdb$database; 
>Select Current_TimeStamp - Cast('00:20:00' as TimeStamp) From rdb$database;
>
>Dynamic SQL Error
>expression evaluation not supported
>unknown ISC error 336397244

<TimeStamp> - <TimeStamp> = <Duration in days>
<TimeStamp> - <Duration in days> = <TimeStamp>
<Time> - <Time> = <Duration in seconds>
<Time> - <Duration in seconds> = <Time>

<TimeStamp> - <Time> doesn't make sense, you simply cannot subtract a point in 
time from a given date and time (E.g. 2012-09-21 08:30:00 - 3pm is logically 
impossible to calculate).

<TimeStamp> - <TimeStamp> is possible, but '00:20:00' isn't a TimeStamp - 
'2012-09-21 00:20:00' is. The result of

select current_timestamp - cast(current_date + cast('00:20:00' as Time) as 
TimeStamp) from rdb$database

would typically be between 0 and 1, but can be slightly less than 0 if done 
shortly after midnight.

Most likely you want <TimeStamp> - <Duration in days>, the best (i.e. most 
readable) way to do this is to use the DATEADD function that Helen has 
described already.

Set

Reply via email to