Обсуждение: Stupid Monday Problem

Поиск
Список
Период
Сортировка

Stupid Monday Problem

От
"Kenn Thompson"
Дата:
Ok- here's the problem ( too little coffee?)...

This query runs under Access. I of course change a bit of the SQL ( removed the '#' and have played with quotes), but
can'tseem to get it to run.
 

What the #%$^& am I doing wrong here?

Kenn


SELECT oid FROM file_header WHERE expire_date < 04/16/00 
ADODB.Recordset.1 error '80004005' 

Error while executing the query; ERROR: Unable to identify an operator '<' for types 'date' and 'int4' You will have to
retypethis query using an explicit cast 
 






Re: Stupid Monday Problem

От
Patrik Kudo
Дата:
Hi.

Dates should be quoted like '04/16/00'
What you're trying to do is to calculate
an integer of value 04/16/00 (which, if
the parser would let it through, would
even generate a division by zero error.)

Regards,
Patrik Kudo

Kenn Thompson wrote:
> 
> Ok- here's the problem ( too little coffee?)...
> 
> This query runs under Access. I of course change a bit of the SQL ( removed the '#' and have played with quotes), but
can'tseem to get it to run.
 
> 
> What the #%$^& am I doing wrong here?
> 
> Kenn
> 
> SELECT oid FROM file_header WHERE expire_date < 04/16/00
> ADODB.Recordset.1 error '80004005'
> 
> Error while executing the query; ERROR: Unable to identify an operator '<' for types 'date' and 'int4' You will have
toretype this query using an explicit cast
 


Re: Stupid Monday Problem

От
Дата:
try  (add '' around date literal):

SELECT oid FROM file_header WHERE expire_date < '04/16/00' 

On Mon, 17 Apr 2000, Kenn Thompson wrote:

> Ok- here's the problem ( too little coffee?)...
> 
> This query runs under Access. I of course change a bit of the SQL ( removed the '#' and have played with quotes), but
can'tseem to get it to run.
 
> 
> What the #%$^& am I doing wrong here?
> 
> Kenn
> 
> 
> SELECT oid FROM file_header WHERE expire_date < 04/16/00 
> ADODB.Recordset.1 error '80004005' 
> 
> Error while executing the query; ERROR: Unable to identify an operator '<' for types 'date' and 'int4' You will have
toretype this query using an explicit cast 
 
> 
> 
> 
> 



Re: Stupid Monday Problem

От
Andrew Perrin - Demography
Дата:
You have to cast the date properly - postgres is interpreting this as 4
divided by 16 divided by 0.  Try:

SELECT oid FROM file_header WHERE expire_date < '04/16/00'::date;

---------------------------------------------------------------------
Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support
Department of Demography    -    University of California at Berkeley
2232 Piedmont Avenue #2120  -    Berkeley, California, 94720-2120 USA
http://demog.berkeley.edu/~aperrin --------------------------SEIU1199

On Mon, 17 Apr 2000, Kenn Thompson wrote:

> Ok- here's the problem ( too little coffee?)...
> 
> This query runs under Access. I of course change a bit of the SQL ( removed the '#' and have played with quotes), but
can'tseem to get it to run.
 
> 
> What the #%$^& am I doing wrong here?
> 
> Kenn
> 
> 
> SELECT oid FROM file_header WHERE expire_date < 04/16/00 
> ADODB.Recordset.1 error '80004005' 
> 
> Error while executing the query; ERROR: Unable to identify an operator '<' for types 'date' and 'int4' You will have
toretype this query using an explicit cast 
 
> 
> 
> 
>