After slapping Excel around successfully, I'm now getting pummeled by Access. I'm using ActiveState Perl and DBD::ODBC. There is an Access field that is a date/time field; I need the get the full date/time data when I query it. BUT, for the SQL query, I only want to compare the date portion, not the date/time.
use Win32::ODBC;
use DBI;
use Date::Manip;
&Date_Init("TZ=EST");
my $now = localtime();
my $start_date = &UnixDate(&ParseDate("$now"), "%m%/%d%/%Y");
$sqlstatement= qq (
SELECT WorkOrd.WO2, WorkOrd.ClearDate
from WorkOrd
where WorkOrd.StatCode5 = 'C' and (
WorkOrd.ClearDate is NULL or (
WorkOrd.ClearDate = ?
)
)
);
$sth = $dbh->prepare($sqlstatement) or die "Could not prepare stateme
+nt. Error:$sth->errstr()\n";
$sth->execute($start_date) or die "Could not execute statement. Error
+:$sth->errstr()\n";
$sth->bind_columns( \$WO2, \$ClearDate );
This only returns things that are NULL in ClearDate, not things that were cleared today. I've tried playing with different UnixDate formats, and that gave the same (incomplete) results. I tried encasing the date in Access-style #, but that bombed with DBS::ODBC errors. I'm not making much headway here; I'd love some hints.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.