Subject Re: [firebird-support] Re: Date problem in Firebird
Author Helen Borrie
At 11:50 AM 12/06/2005 +0000, you wrote:
>The other date problem that I have run across is the use of a
>regular date syntax within in SQL statement.
>
>ie.
>
>SELECT FROM mytable WHERE mydatefield > 1/01/2004;
>
>This results in this error: conversion error from string "0".
>
>Is there a way to get regular date to work in 1.5 WITHOUT casting or
>some function use.

Yes, use a date literal, that is, an engine-recognised stringish date
format enclosed in single-quotes. 'xx/xx/xxxx' is dangerous unless you're
in the USA because it will be interpreted always as 'mm/dd/ccyy' so
'25/12/2005' is an illegal date. '1/01/2005' is a legal date. So is
'12/13/2005'; but '13/12/2005' isn't.

Several formats are safer, e.g. 'dd-Mmm-ccyy', 'dd.mm.ccyyy', 'ccyy-mm-dd',
'ccyymmdd', to name a few.


>I'm converting from sereval other databases and this type of SQL
>statement is standard.

It's *standard* not to quote date literals? How are these "standard"
databases going to distinguish your expression from an illegal calculation
expression?

./hb