[Zope] ZSQL select on date/time
Loren Stafford
lstafford@morphics.com
Fri, 6 Jul 2001 18:51:01 -0700
Thanks,
That put me on the right track.
I also found a how-to on the subject
http://www.zope.org/Members/teyc/howSQLDateTime, which suggests:
select * from activity where activity_date= { ts '<dtml-var Mydate
fmt=ISO>'}
My final ZSQL method is:
select * from "Applicant Database"
where [Last Name] like <dtml-sqlvar LastName type=string>
and [First Name] like <dtml-sqlvar FirstName type=string>
and Position like <dtml-sqlvar Position type=string>
and [Date Received] between { ts '<dtml-var FromDate fmt=ISO
sql_quote>'}
and { ts '<dtml-var ThruDate fmt=ISO sql_quote>'}
-- Loren
>
> Loren Stafford wrote:
> >
> > Does anyone have a working example of how to select on a
> date/time column in
> > an MSAccess database.
> >
> > Something like
> >
> > Arguments: FromDate:date
> >
> > select * from "Applicant Database"
> > where [Date Received] > <dtml-sqlvar FromDate type=float>
> >
> > ...except the above syntax produces:
> >
> > Error type: sql.error
> > Error value: ('07001', -3010, '[Microsoft][ODBC Microsoft
> Access Driver] Too
> > few parameters. Expected 1.')
> >
> > ...regardless of value of type.
> >
> > -- Thanks
> > -- Loren
> >
>
> I think MSAccess expects it's dates to be delimited by # as in:
> #7/6/2001#
>
> You might try:
>
> select * from "Applicant Database"
> where [Date Received] > #<dtml-var FromDate fmt="%x" sql_quote>#
>
> --
> | Casey Duncan
> | Kaivo, Inc.
> | cduncan@kaivo.com
> `------------------>
>