Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 3 of 3 total |
need help formatting a where clause |
Thu, Mar 15 2007 4:56 PM | Permanent Link |
Jerry Blumenthal | I need to do a search for a record using a WHERE clause, looking for a
match with a date time. The date and time = 12/29/2005 10:00:00 AM How do I format a where clause to look for that? Using DateToDBIsamString gives me "12/29/2005". Jerry |
Thu, Mar 15 2007 5:37 PM | Permanent Link |
Steve Forbes Team Elevate | Hi Jerry,
If the date/time parameter is going to change, I would strongly suggest using an SQL parameter which will remove your problems entirely e.g. SQL.Text := 'SELECT * FROM MyTable WHERE DateTimeColumn = TimeStamp'; ParamByName('pmTimeStamp').AsDateTime := DateTimeVariable Active := True; otherwise, IIRC the date/time value should be formatted as follows in the SQL statement: WHERE DateTimeColumn = '2005-12-29 10:00:00.00' HTH -- Best regards Steve "Jerry Blumenthal" <jerry@blumenthalsoftware.com> wrote in message news:F07A777D-BB5C-4C9D-8C24-9FBFE6052949@news.elevatesoft.com... >I need to do a search for a record using a WHERE clause, looking for a >match with a date time. > > The date and time = 12/29/2005 10:00:00 AM > > How do I format a where clause to look for that? Using DateToDBIsamString > gives me "12/29/2005". > > Jerry |
Thu, Mar 22 2007 5:25 PM | Permanent Link |
"Adam H." | Hi Jerry,
Just to add to what Steve mentioned, you may want to consider using 2 where clauses, and doing an 'inbetween'. Maybe something like WHERE (DateTimeColumn > '2005-12-29 09:59:59') and (DateTimeColumn < '2005-12-29 10:00:01'). IIRC, the DateTime formats are stored as a floating value, which means (calculating to the millisecond) you may not get an exact match to the millisecond for a recorded record. (If that makes sense). Normally, to combat this, I use greater than and less than, and seperate by a second as described above. Cheers Adam. |
This web page was last updated on Friday, May 3, 2024 at 08:07 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |