Article View: borland.public.cppbuilder.database.ado
Article #3205Re: SQL datetime format
From: Giuliano
Date: Thu, 05 Dec 2002 20:13
Date: Thu, 05 Dec 2002 20:13
28 lines
1837 bytes
1837 bytes
On Wed, 4 Dec 2002 20:33:16 +0800, "alex" <alex@cybergraphy.com> wrote: >Hi , > > What is the date time format in SQL to limit the query in some time >range > for example : > > select column from table where time between "2/11/2002" and " 2/22/2002" > >(The above syntax get an syntax error exception in ADO Query ) Date format can vary between different providers/languages. It's better to use paramteres to pass a date to a query. For example: select column from table where time between :from and :to Then you can use the Parameters property of TADOQuery/TADODataSet to fill properly the two values you have to pass. Components, they translates for you, the date in the format that likes to your target rdbms engine. Good luck. Ciao! Giuliano P.S. is better if you don't use 'time' like column's name.
Technical Details
Message-ID:
<g9cvuugoe1gdsmfg32260bjgrsj04n56re@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c02.atl3!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3dedf62a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,13893c5bae619670 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-12-05 12:31:38 PST From: Giuliano <gcardinali@remove.adhoc.net> Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: SQL datetime format Date: Thu, 05 Dec 2002 21:13:54 +0100 Message-ID: <g9cvuugoe1gdsmfg32260bjgrsj04n56re@4ax.com> References: <3dedf62a@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 81.72.236.130 X-Trace: newsgroups.borland.com 1039119230 81.72.236.130 (5 Dec 2002 12:13:50 -0800) Lines: 31 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c02.atl3!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail