Board index » delphi » ''%'' wildcard and case sensitivity

''%'' wildcard and case sensitivity

My Delphi 3 application use localSQL on Paradox 5.0 tables ( BDE V4.0). When
I use the following statement:

Select * from MyTable where MyField like 'MyString%'

the result is not case sensitive and that is what I want, but if I use the
''%'' wildcard before the string ('%MyString%') the result is now case
sensitive!

Is this normal?
How to solve this problem?

Thank you

 

Re:''%'' wildcard and case sensitivity


Patrice Bouchard <patri...@total.net> wrote in article
<71lrl3$5...@forums.borland.com>...

Quote
> My Delphi 3 application use localSQL on Paradox 5.0 tables ( BDE V4.0).
When
> I use the following statement:

> Select * from MyTable where MyField like 'MyString%'

> Is this normal?
> How to solve this problem?

Try this SQL instead:

Select *
From MyTable
Where SubString(MyField From 1 for 8) = 'MyString'

The "8" would be the length of the string you are searching for.

        -- Kirk

Re:''%'' wildcard and case sensitivity


On Mon, 2 Nov 1998 22:02:32 -0500, "Patrice Bouchard" <patri...@total.net>
wrote:

Quote
>My Delphi 3 application use localSQL on Paradox 5.0 tables ( BDE V4.0). When
>I use the following statement:

>Select * from MyTable where MyField like 'MyString%'

>the result is not case sensitive and that is what I want, but if I use the
>''%'' wildcard before the string ('%MyString%') the result is now case
>sensitive!

>Is this normal?
>How to solve this problem?

Yes, this is normal. By default, string comparisons in SQL (not just local
SQL) are case-sensitive. To override this default behavior, force the
values on both sides of the comparison operator to be all in the same case.
Do this with either the UPPER or LOWER function. String literals can
obviously be typed all in one case, but a column or parameter value
requires one of thesefunction calls.

  SELECT *
  FROM MyTable
  WHERE UPPER(MyField) LIKE "MYSTRING%"

//////////////////////////////////////////////////////////////////////////
Steve Koterski                 "What is success in this world? I would say
Technical Publications         it consists of four simple things: to live
INPRISE Corporation            a lot, to love a lot, to laugh a lot, and
http://www.inprise.com/delphi  from it all, to learn a lot."
                                                     -- Richard J. Needham

Other Threads