How can I do a case insensitive search?
Posted in 1999
Topics: General Discussion
How can I do a case insenitive search in a SQL-Statement, I mean,
somethin like this
SELECT foo
FROM anicetable
WHERE string1 = strInG2;
Thanks for your help.
Fin
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
In article <784h6v$1ja$1@nnrp1.dejanews.com>,
fschuppenhauer@my-dejanews.com wrote:
> How can I do a case insenitive search in a SQL-Statement, I mean,
> somethin like this
>
> SELECT foo
> FROM anicetable
> WHERE string1 = strInG2;>
Try using "matches" as in:
WHERE string1 MATCHES '[Ss][Tt][Rr][Ii][Nn][Gg]2'
I use a small Perl script to construct the regex after the MATCHES for me.
I also find it ridiculous that there seems to be no case-insensitive
search available to the engine. Perhaps someone will show me a better way
- one that doesn't make me resent _having_ to do it that way...
In article <vin-2001990827000001@ron-ny1-14.ix.netcom.com>, Vin
<vin@syntegra-consulting.com> writes
>In article <784h6v$1ja$1@nnrp1.dejanews.com>,
>fschuppenhauer@my-dejanews.com wrote:
>
>> How can I do a case insenitive search in a SQL-Statement, I mean,
>> somethin like this
>>
>> SELECT foo
>> FROM anicetable
>> WHERE string1 = strInG2;>>
>Try using "matches" as in:
>WHERE string1 MATCHES '[Ss][Tt][Rr][Ii][Nn][Gg]2'
>
>I use a small Perl script to construct the regex after the MATCHES for me.
>I also find it ridiculous that there seems to be no case-insensitive
>search available to the engine. Perhaps someone will show me a better way
>- one that doesn't make me resent _having_ to do it that way...
Noooo!!! That will not use an index, use a second column in the table
which is the uppercase version of the column you wish to search on!!
PS This has just be added to the FAQ courtesy of June Tong!, I will
put the new version out tonight at www.smooth1.demon.co.uk!
--
David Williams