Subject Re: Including year in search of timestamp field
Author bhatakeyama
--- In ib-support@y..., Helen Borrie <helebor@t...> wrote:

>
> The TIMESTAMP type (along with the other date/time types) is not a
string,
> it is a numerical value. Therefore, when searching on date/time
types, the
> criteria must evaluate to numbers, not strings.
>
> Date literals (which look like strings) can be used in
search expressions
> involving complete date or date/time types. In some situations, you
need
> to CAST date literals. However, because the engine does not
interpret date
> literals as strings, it is not valid to use CONTAINING, LIKE or
STARTING
> WITH in a date search.
>
> An example of a timestamp search expression would be
> ...WHERE MyStoredTimestamp BETWEEN '2002-01-01' AND '2002-08-03'

Since Timestamps are stored in 64-bit binary the engine has to
either convert the '2002-01-01' and '2002-08-03' to binary or
convert the data field to text, or maybe both to a 'tm' structure.

If I have an expression of:
... WHERE MyStoredTimestamp CONTAINING '08-03'
It retrieves all Auguest 3 records and excludes all others. To
me this implies that the engine is converting my text correctly
to match my Timestamp, or more likely the engine is converting
the timestamp to text.

Similarly if I have a 32-bit integer the following expression works:
... WHERE MyInt CONTAINING '1'
Will retrieve records, MyInt=
1, 10, 11, 12, ..., 21, 31, etc.
This also makes it appear that the integer is being converted to
a string and then a text comparison is being made.

Are you implying that both of these should be invalid?

Thanks.

______________________________________________________________________