Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

DBD::ODBC / ACCESS-SQL incompliancy

by PerlingTheUK (Hermit)
on Oct 17, 2006 at 14:59 UTC ( #578797=perlquestion: print w/ replies, xml ) Need Help??
PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
I am sorry this is slightly off topic but it has been annoying me for quite a while now. I have the following query which is restricted on a specific date:
SELECT * FROM TBLDATA WHERE ([Event Date] LIKE 8/08/2006*');
This query runs fine within MS Access. If I use the exact same query via DBD::ODBC from perl it fails. Can anyone help?

Cheers,
PerlingTheUK

Comment on DBD::ODBC / ACCESS-SQL incompliancy
Download Code
Re: DBD::ODBC / ACCESS-SQL incompliancy
by VSarkiss (Monsignor) on Oct 17, 2006 at 15:26 UTC

    You probably have a copy-and-paste error, because even in Access that shouldn't run: you've got an unmatched single quote at the end. You probably meant this:

    SELECT * FROM TBLDATA WHERE ([Event Date] LIKE '8/08/2006*');
    The question then is, what data type is [Event Date]? If you're storing the date as a string, then you need to match the string format exactly. Otherwise, if you're storing it as a date, you should be able to do it with the funny Access hash-quotes:
    SELECT * FROM TBLDATA WHERE ([Event Date] = #8/08/2006#);
    If that doesn't work you may want to try canonical ODBC date format: '2006-aug-08'. It's hard to say without knowing more about the database and the code.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://578797]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (16)
As of 2014-09-19 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls