Subject Re: American date format in SQL Statements
Author Adam
--- In, "Bhavbhuti Nathwani"
<venussoftop@h...> wrote:
> Hi all
> Is only American style of date allowed to be passed to an SQL
> statement?
> My VFP app uses British style of date dd/mm/yyyy and I was not able to
> query using SQL Pass Through.

I use parametised queries to do it in Delphi,

So the query is something like this.

'select name
from tableA
where InterestingDate = :InterestingDate';

When you want to execute it.

qry.ParamByName('InterestingDate').AsDate := somedatevariable;;

I do not know if VFP supports such a feature, but the advantage is that
it totally removes region formatting from the query altogether. It has
the added bonus of being preparable, which is great if you need to run
this query over and over. For example, it is likely your program (or
some object inside it) had to run some sort of FormatDate routine to
get a string representation of the date. At the other end, Firebird has
to reverse it from a string back to its internal date format. Working
that way seems a bit redundant to me.

Failing that, there is no setting to interpret '5/6/2005' as 5 June
2005 (thankfully, imagine the gotchas). There are heaps of other
strings that interpret different ways. Such as '5.6.2005' which is
d.m.yyyy and '2005-6-5' which is 'yyyy-m-d'. So see if there is a way
of passing the dates naturally rather than as a string, but if not,
either format it m/d/yyyy or use one of the other formats.