You are indeed telling DBI that you will have one bind var
with this line of SQL:
WHERE ((x Is Not Null) AND ([Today's Date]> ?))
But it seems that DBI (or the ODBC driver) doesn't like that
line. First off, a field name of "Today's Date" is
god-awful ... i don't use spaces or any special characters
in my tables or my fields, regardless of whether or not it
is valid to do so. It most definitely is not portable. Why
not name that field
today_date or such? Much easier
to deal with.
My recommendation is to simplify your test, maybe something
like:
my $dbh = (
'connection string', 'user', 'pass',
{RaiseError => 1}, # IMPORTANT!!!
);
my $sth = $dbh->prepare(q|
select * from Referrals
where [Today's Date] > ?
|);
$sth->execute($date);
And see what happens. If that doesn't reveal anything new,
then how about simply:
my $sth = $dbh->prepare(q|
select [Today's Date] from Referrals
|);
$sth->execute();
UPDATE:
I really am no DBI expert ... but this might just be a bug
within DBI ... maybe DBI chokes on elaborate field names
and or the square brackets when it tries to bind the vars.
A cheap solution is to just interpolate $date instead your
SQL string ... but only do this if you trust the contents
of $date or really scrub it like
skyknight suggested.
(
skyknight++)
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
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.