🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #676

Re: Query Date Format

#676
From: Steve Koterski
Date: Wed, 05 Aug 1998 00:00
45 lines
2351 bytes
On Wed, 5 Aug 1998 10:30:00 -0800, "Bradner/Klein"
<p1554@mail.aai.arco.com> wrote:

>I'm trying to use the criteria of the following xbase command in a SQL query
>...
>
>set filter to expir>{01/01/99} and expir<{01/01/02}
>
>As written above, the statement works fine, showing records with expiration
>dates both in the final year of this century and into the next.
>
>My SQL version of this, however, doesn't work, returning no records at all
>...
>
>select * from mytable where expir>"01/01/99" and expir<"01/01/02"
>
>What puzzles me is that ...
>
>select * from mytable where expir>"01/01/99"
>
>does return the records I'm looking for (without the outer-range limit),
>both in this century and the next.
>
>I tried "SET EPOCH TO 1930" but that had no effect. As usual I've run out of
>ideas fast. Thanks for help.

You do not indicate what version of the BDE is involved here. My suspicion
is that the SQL comparison is using the two years 1999 and 1902, and you
should never have any records where a date field is greater than the former
and less than the latter. If you explicitly include the full year values in
your SQL statement, do you then get the results you expected?

  SELECT *
  FROM mytable
  WHERE (expir BETWEEN "01/01/1999" AND "01/01/2002")

How to handle this situation and how two-digit year values are interpreted
varies across different versions of the BDE. So knowing that would be
necessary to provide a more general solution.

//////////////////////////////////////////////////////////////////////////
Steve Koterski                      "Knowledge comes, but wisdom lingers."
Technical Publications                -- Alfred, Lord Tennyson (1809-1914)
INPRISE Corporation
http://www.inprise.com/delphi
Technical Details
Message-ID: <35c8a5b9.11306676@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6qa89r$bdg16@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,81848bf899413727,start
X-Google-Attributes: gidff5a1,public
From: koterski@borland.com (Steve Koterski)
Subject: Re: Query Date Format
Date: 1998/08/05
Message-ID: <35c8a5b9.11306676@forums.inprise.com>
X-Deja-AN: 378253672
Content-Transfer-Encoding: 7bit
References: <6qa89r$bdg16@forums.borland.com>
Content-Type: text/plain; charset=us-ascii
Organization: INPRISE Corporation, Technical Publications
Mime-Version: 1.0
Reply-To: koterski@borland.com
Newsgroups: borland.public.vdbase.data.sql