If you're just getting started, I would suggest validating the SQL in Access before 
trying to put it into perl.

IS NULL and IS NOT NULL statements should not be enclosed in quotes. SQL wildcards are 
represented with the percent symbol. I assume you were searching for strings starting 
with 0. Note that data types are not coerceable so LIKE '0%' will not work on a field 
defined as numeric.

Cheers,

Erik

SELECT Junk1, Junk2, Junk3, Junk4, Junk5, Junk6, Junk7 FROM Junk WHERE Junk1 IS NOT 
NULL AND Junk2 LIKE '0%' AND Junk3 IS NOT NULL AND Junk4 LIKE '0%' AND Junk5 = IS NOT 
NULL AND Junk6 = IS NOT NULL AND Junk7 = IS NOT NULL

-----Original Message-----
From:  Scott Hibbard 
Date:  19/1/04 0:45
To:  Perl Win32 DB List , Perl Win32 Users List , Bruce Reed 
Subj:  Re: Questions about Win32::ODBC and MS Access

Bruce,

Thanks for your input.

I've tried using AND or commas to separate the column values in the query,
and I keep getting the 'missing operator' error. Since operators are
included in the syntax I'm using, I'm not sure if I'm merely writing bad
syntax, or if there's a fine point about nesting SQL within Perl that I've
missed. Anyway, I tried your suggestion and the error message is below.

Thanks,

Scott

"[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator)
in query expression 'Junk1 = 'Not Null' AND
                Junk2 = '0*' AND
                Junk3 'Not Null' AND
                Junk4 = '0*' AND
                Junk5 = 'Not Null' AND
                Junk6 = 'Not Null' AND
                Junk7='Not Null'
     '."



----- Original Message ----- 
From: "Bruce Reed" <[EMAIL PROTECTED]>
To: "Scott Hibbard" <[EMAIL PROTECTED]>; "Perl Win32 DB List"
<[EMAIL PROTECTED]>; "Perl Win32 Users List"
<[EMAIL PROTECTED]>
Sent: Sunday, January 18, 2004 3:48 PM
Subject: Re: Questions about Win32::ODBC and MS Access


> I hope you don't mind an answer from someone who has never actually done
> SQL programming.
>
> You need AND between each condition:
> if ( $db->Sql("SELECT Junk1, Junk2, Junk3, Junk4, Junk5, Junk6, Junk7
>                FROM Junk
>                WHERE
>                  Junk1 = 'Not Null' and
>                  Junk2 = '0*' and
>                  Junk3 'Not Null' and
>                  Junk4 = '0*' and
>                  Junk5 = 'Not Null' and
>                  Junk6 = 'Not Null' and
>                  Junk7 = 'Not Null'"))
>
> The missing operator is "and".
>
>
> At 1/18/2004 04:24 PM, Scott Hibbard wrote:
>
> >All,
> >
> >Need some guidance with a project. Code is below.
> >
> >Basically, the idea is to open an MS Access database, query data from it
to
> >a DataHash, and then write the data in the hash out to a text file.
> >
> >I've run into 2 problems in particular:

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to