Board index » delphi » Local SQL and Dates

Local SQL and Dates

I was using Access 97 Tables and Delphi 3.0, with the following SQL:

SELECT value.PAYDAY from value
WHERE
month(value.PAYDAY) = month(Now) and
Year(value.PAYDAY) = Year(Now)
ORDER BY value.PAYDAY

It worked ok.

Now I'm working with DBASE 5.0 Tables, and it does'nt works anymore. with
the message: <Invalid Token: month(value.PAYDAY)>
How can I query a Date with Dbase tables ?

Thanks in Advance

Patrick

 

Re:Local SQL and Dates


You need to write

var
  y, m, d : word;
begin
  decodedate(date, y,m,d);
end;

and then the WHERE clause becomes

WHERE ((EXTRACT MONTH FROM PAYDAY)=IntToStr(m)) AND
((EXTRACT YEAR FROM PAYDAY)=IntToStr(y);

Nick Spurrier (MoDESoft, UK)

Other Threads