Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access data base datetime query - what datetime format??
Message
 
To
25/07/2003 05:04:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00813055
Message ID:
00813459
Views:
6
Cetin,
I can't thank you enough. People like you are why I subscribe to the Universal Thread. I now have data comming into VFP exactly the way I want.

John


>John,
>First I didn't include #dateliteral# format. It can be used but Access waits the dateliteral be in either US format or YYYY/MM/DD format. I find it restricting and not reliable. Second, using that style your SQL is limited to Access. OTOH ? parametric passing is recognized by not only access but by other backends like SQL server, Oracle etc.
>If you want to use it you might construct your query like :
>
>ldStart = {^1996/07/01}
>ldEnd = {^1996/07/31}
>
>lcSQL = "select * from [Orders] where [RequiredDate] between #"+;
>  Transform(Dtoc(ldStart,1), '@R 9999/99/99')+"# and #"+;
>  Transform(Dtoc(ldEnd,1), '@R 9999/99/99')+"#"	
>
>However it would get quickly tedious as field count increases.
>
>lcSQL = "select * from [Orders] where [RequiredDate]"+;
> " between ?ldStart and ?ldEnd"
>
>Is more compact and understandable IMHO.
>
>I don't know a place that have samples. But I think you also don't need the samples :) Any SQL you know in VFP (provided you don't use VFP specific formats and functions) would work. ie:
>
>Most backends do not understand :
>
>between(indate,?ldStart,?ldEnd)
>
>But they all understand :
>
>indate between ?ldStart and ?ldEnd
>
>Some VFP functions are also recognized by other backends. ie: In access date(1996,10,1) is same as in VFP, left(), right() exists in many backends etc. You would need to check Access help for its supported functions (but I'd stick with globally known ways of defining a query as much as I can).
>
>One note that might be helpfull for Access, surround your table, fieldnames with brackets ([]). Access table and field names can contain spaces and start with a digit. Brackets let you correctly point to a table, fieldname. ie:
>
>select * from [my Access Table] where [my Access Table].[my field] like 'A%'
>
>Other than that using ? parameterizing your SQL statements for insert, update, select, delete etc should be easy.
>Cetin
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Previous
Reply
Map
View

Click here to load this message in the networking platform