Re: select * from calls where timestamp > ?????
Posted in 2007
Doug Lawry wrote:
> The default DATETIME format is as follows:
>
> select * from calls where timestamp > '2007-07-06 07:42:34'>
> If you are using version 9 or later and need to use a different format, look up
> the TO_DATE function in the SQL Syntax manual or InfoCenter.
Or use the full DATETIME(2007-06-6 07:42:34) YEAR TO SECOND notation.
The advantage of this verbose notation should be that instead of
converting the timestamp to a string, it will do the comparison
directly, which should be faster. Whether that is 'measurably faster'
is a harder question. It might also be able to make better use of an
index with timestamp in the leading column.
Finally, beware 'timestamp' - it is a keyword in ISO standard SQL and
could easily become one in a future version of IDS, albeit not in IDS
Cheetah.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2007.0226 -- http://dbi.perl.org/