Local SQL Date/Time-related operations

This is as repost of an article which gave no response at all. I find
this strange, as the problem could be fairly common.

PLEASE - share with me your experiences!

>Something for all you SQL gurus to chew on:
>1. Usage of Date/Time fields (Paradox Table)
>Working inside the Database Desktop:
>SELECT * From BokData
>This gives me a column with the date/time-field StartTid having some
>rows containing "08.30.00, 1996-02-05"
>but this
>SELECT * From Bokdata
>where Starttid="08.30.00, 1996-02-05"
>gives me the error message: "Expression in this field has the wrong
>I've tried turning this statement around in all possible ways, but it
>just doesn't work. What is wrong ??
>2. Same Paradox tables
>This works:-
>SELECT * From Bokdata,Bokning,Aktiv,Produkt,Kund
>Where Bokning.BokningNr=Bokdata.BokningNr
>And Bokning.Aktiv=Aktiv.AktNr
>And Bokning.Prod=Produkt.ProdNr
>And Bokning.Kund=Kund.KundNr
>but wher I add this line, the Query DLL comes crashing down on me
>And EXTRACT(YEAR FROM Bokdata.StartTid)=1996
>This also works fine
>SELECT * From Bokdata,Bokning
>Where Bokning.BokningNr=Bokdata.BokningNr
>And EXTRACT(YEAR FROM Bokdata.StartTid)=1996
>the used joins use indexed fields, no problems there
>Have I come across some limit in Local SQL or BDE?

Since I got no responses to these questions, I'll publish the
workaround solution I stumbled on by accident:

        DT1, DT2: TDateTime;

        Query1.SQL.Add('And Bokdata.StartTid>='+Format('%g',[Dt1]));
        Query1.SQL.Add('And Bokdata.slutTid<'+Format('%g',[Dt2]));


In other words - treat the DB DateTime value as a numeric (double)

A few questions still remain -
1. Is this the accepted way to work with Date/Time in the BDE? I
realize there are many ways of _presenting_ the values based on
national and/or international conventions, but it shouldn't affect the
query or the underlying data. Or should it?
2. Is it transparant to the underlying DB?
3. What about ODBC - can I use this solution when/if my app is ported
to use ODBC data sources?

I can't find any information on this subject in the so-called manuals
or in the OLH.

Any feedback on this would be appreciated (Borland - where are you?)


Lars G. Oerne   (SM7BLJ)     MoSoft
P.O.Box 72                   S-340 36 MOHEDA Sweden
Cell Phone +46 0705441225    "The House of FRITSON"
email l...@mosoft.se
My views are the same as my employers'. They better be...