RE: [PHP-DB] Non case-sensitive SQL Query
| From: | Doug Semig | Date: | Fri, 18 Aug 2000 18:38:55 +0000 |
| Subject: | RE: [PHP-DB] Non case-sensitive SQL Query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2164@lists.php.net to get a copy of this message | ||
DB2 is operating correctly and in a standards compliant manner. It's not a
matter of being "by default case sensitive on queries," it's a matter of
selecting a collating sequence when evaluating the LIKE predicate.
We **just** talked about this! I mean like 3 days ago...right here on this
list! Is it super-horrible to look at the archives? Maybe someone should
get this question and the right answer in FAQTS (or whatever it's called)
so we don't see it every few days.
http://marc.theaimsgroup.com/?l=php-db&m=96636906117977&w=2
is a link to
first message of the 3 day old thread on this exact topic.
The correct solution has already been given in this thread, though not by
me this time. Use UPPER() in the SQL query.
Doug
Jeroen ten Berge was heard at 01:32 PM 8/18/00 +0200 to say:
>Is DB2 by default case sensitive on queries ?
>You could do an like 'Anders%' or like 'anders%'
>
>
>-----Original Message-----
>From: Anders Dannberg [mailto:anders.dannberg@edk.se]
>Sent: Friday, August 18, 2000 12:44
>To: php-db@lists.php.net
>Subject: [PHP-DB] Non case-sensitive SQL Query
>
>
>Hi all!
>
>I need some help on how to make a NON case-sensitive sql query. I use the
>following query which outputs what i need:
>
>$query = "SELECT * FROM user INNER JOIN maintable ON user.number =
>maintable.number WHERE name LIKE 'Anders%'";
>
>However, as this is case-sensitive, it will not display, for example records
>containing "anders", but only "Anders" etc.
>Is there a way i can make sql-queries NON case-sensitive (without changing
>the already inputted data in the DB)
>
>Is there a way i can do this in within the code? Without any changes to
>database settings...
>I'm using DB2, PHP4.
>
>Thanks in advance.
>Anders
>