Board index » delphi » Local SQL - problem with query using a DATE

Local SQL - problem with query using a DATE

Hi,

I have this stupid problem that I don't know how to fix:

I am querying a Local Paradox table using the following SQL statement:

"select * from mytable where TransDate > '01-APR-1997'"

This statement works fine, but I want to change the '01-APR-1997' to
something like '1997/04/01'. I get a type mismatch error when trying to do
this.

Is there a something I can do (BDE configuration perhaps?) to change the
format of a date in a Local SQL statmement?

Regards,
Marius Booysen.
Email: booys...@qttsud2301.telkom.co.za

 

Re:Local SQL - problem with query using a DATE


You could use the TDateTime value directly in your query, which avoids a
lot of problems.

i.e. Sql.Add('where thedate = '+IntToStr(Trunc(Date)));

Marius <booys...@qttsud2301.telkom.co.za> wrote in article
<01bc4ca4$455cfa00$eaee8...@home-msb.telkom.co.za>...

Quote
> Hi,

> I have this stupid problem that I don't know how to fix:

> I am querying a Local Paradox table using the following SQL statement:

> "select * from mytable where TransDate > '01-APR-1997'"

> This statement works fine, but I want to change the '01-APR-1997' to
> something like '1997/04/01'. I get a type mismatch error when trying to
do
> this.

> Is there a something I can do (BDE configuration perhaps?) to change the
> format of a date in a Local SQL statmement?

> Regards,
> Marius Booysen.
> Email: booys...@qttsud2301.telkom.co.za

Other Threads