MS Access is really funny. They store their dates in yyyy-mm-dd hh:mm:ss format, no matter how you think it looks in the table. And you can't simply write that format into the date field. :(

I ran into a similar issue a while back when trying to write a date to an MS Access database. I ended up having to use {ts '2001-01-01 23:59:59'} to pull it off. Granted, your issue may be unrelated, but if you're looking for dates, you may have to write them too.

So, anyway, back to your question: I tried this out earlier, and it should suit your needs, but is most likely a quick hack:

WHERE field BETWEEN #1/1/$year# AND #12/31/$year#

Update: While sifting through the Cheetah Book (Programming the Perl DBI), I noticed that on page 293 it says this:

Similar escape sequences are defined for other date/time types. Here's the full set:
{d 'YYYY-MM-DD'} - date {t 'HH:MM:SS'} - time {ts 'YYYY-MM-DD HH:MM:SS'} - timestamp {ts 'YYYY-MM-DD HH:MM:SS.FFFFFFF'} - timestamp

Further research at that dratted MSDN does indeed indicated that that is the full set


Sarah
If Bill Gates can name a company after his "bedroom" problems, I can have a stupid sig that points it out.

In reply to Re: Type casting by monkeygirl
in thread Type casting by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.