Article View: borland.public.vdbase.data.sql
Article #854Re: SQL select and dates
From: Steve Koterski
Date: Fri, 12 Jun 1998 00:00
Date: Fri, 12 Jun 1998 00:00
36 lines
2165 bytes
2165 bytes
On Fri, 12 Jun 1998 19:12:24 +0200, "scratchy" <quake@post.inet.lt> wrote: >Can anyone explain how to use date variables in WHERE clause (SELECT >Statement) ? > >I get "Database Engine Error: Token not found". Without seeing the actual SQL statement that caused this error, it would be difficult to say. However, a good guess is that you are asking what SQL function or keyword can be used in an SQL statement to retrieve the current date. The SQL-92 specification defines a number of functions that serve this purpose: CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP. The ability to use any or all of these SQL functions will depend on the database type used. If you are using local SQL (dBASE and Paradox tables), you cannot use them. These SQL-92 functions are not part of the subset of SQL-92 that comprises local SQL, nor are there any equivalents. For other database types, check the documentation for the specific database type to see what is supported. To use the current system type in local SQL statements, you would need to either pass it to the SQL statement as a parameter or make it a literal in an SQL statement dynamically constructed. Here is an example of the former: SELECT * FROM Accounts A WHERE (A.DateDue BETWEEN :DateParam AND :DateParam - 30) ////////////////////////////////////////////////////////////////////////// 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:
<35817418.11119560@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6lrni6$fun3@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,d82ad60540e03158 X-Google-Attributes: gidff5a1,public From: koterski@borland.com (Steve Koterski) Subject: Re: SQL select and dates Date: 1998/06/12 Message-ID: <35817418.11119560@forums.inprise.com> X-Deja-AN: 362096767 Content-Transfer-Encoding: 7bit References: <6lrni6$fun3@forums.borland.com> Mime-Version: 1.0 Reply-To: koterski@borland.com Content-Type: text/plain; charset=us-ascii Organization: INPRISE Corporation, Technical Publications Newsgroups: borland.public.vdbase.data.sql