From:                   "Phil R Lawrence" <[EMAIL PROTECTED]>
To:                     <[EMAIL PROTECTED]>
Subject:                DBD::ODBC problem
Date sent:              Sun, 25 Mar 2001 23:05:43 -0800


Phil,

> I have a query that returns '3' (the correct answer) when I paste
> the SQL into an Access Query and run it.  However, the same query
> returns '0' when I run it using DBD::ODBC.  Can anyone please
> help me find why?
> 
> Here is the simple test script:
> _________________________________________________
> use warnings;
> use strict;
> use DBI;
> 
> $| = 1;
> 
> DBI->trace(3,'trace.log');
> my $DSN = 'driver=Microsoft Access Driver (*.mdb);dbq=BLAH.mdb';
> my $dbh = DBI->connect("dbi:ODBC:$DSN", '', '', {RaiseError =>
> 1})
>     or die "Couldn't connect!";
> 
> my $count = $dbh->selectrow_array(<<"");
>     SELECT Count(YOQsScheduledCode)
>       FROM (
>            SMSMaster INNER JOIN tblYOQsScheduled
>                      ON SMSMaster.AccountNum =
> tblYOQsScheduled.SMSAccountNum
>            ) INNER JOIN tlkpSiteIDNurseStation
>              ON SMSMaster.NurseStation =
> tlkpSiteIDNurseStation.NurseStation
>      WHERE tlkpSiteIDNurseStation.Identifier = '1018'
>        AND ScheduledDate >= #2001-01-01#
>        AND ScheduledDate <= #2001-03-25#
>        AND ScheduledRespondents LIKE '*4*'
                                        ^ ^

try using % as placeholders with the LIKE-operator instead of asterisks.

HTH

Bodo

[EMAIL PROTECTED]

Reply via email to