[INTERFACES] Pattern matching fun via ODBC - Mailing list pgsql-interfaces

From Mike Mascari
Subject [INTERFACES] Pattern matching fun via ODBC
Date
Msg-id 385E2C56.7355C6F2@mascari.com
Whole thread Raw
List pgsql-interfaces
 >David C Hartwig Jr wrote:
>
> Mike Mascari wrote:
>
> > Hello,
> >
> > SELECT workorders.workorder, workorders.workorderno,
> > equipment.assetno, equipment.controlno
> > FROM workorders, equipment
> > WHERE equipment.assetno LIKE '%214%'
> > AND workorders.equipment=equipment.equipment
> > ORDER BY workorders.workorder;
> >
> > gets re-written by Access as this:
> >
> > "SELECT "workorders"."workorder","equipment"."equipment"
> > FROM "equipment","workorders"
> > WHERE (("equipment"."assetno" = '%214%' )
> > AND ("workorders"."equipment" = "equipment"."equipment" ) )
> > ORDER BY "workorders"."workorder"
>
> I don't have Access 97 installed on any of my systems at this time, so
> I cam not verify what I am about to say.  But I seem to recall that
> Access uses asterisk (*) as the wild card character.      I think it is
> the MS Jet Engine that is transforming your statements.   I believe the
> Jet sees the percent (%) character as just another character and so in
> its infinite wisdom optimizes for you - transforming the LIKE to an
> equal (=).  Pretty thoughtful of them.   :>(
>
> I believe (in the context of a LIKE expression) the Jet will transform
> your asterisks (*) to percents (%).

Unbelievable!

You're absolutely correct. I had tried using asterisks with
the equality operator, but I had never thought to use both
LIKE and asterisks. Wow! Thanks...

Mike Mascari

pgsql-interfaces by date:

Previous
From: "stuart"
Date:
Subject:
Next
From: Michael Meskes
Date:
Subject: Access problems