Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql Like statement to ignore case 2

Status
Not open for further replies.

colin81

Technical User
Jul 22, 2002
77
GB
Hi all

Is there a way to use a like statement within a where clause to ignore case. As at present when I query a db it only finds the records if the case is matched also.

I.e

SELECT * FROM tbl WHERE myfield LIKE '%SMITH%'

Will only pull back SMITH when I want it to find smith SmiTH etc as long as it reads smith.


Many Thanks
Colin
 
Depending your DBMS you may use a function like uppercase or toupper or ucase or ....

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I am guessing that the the poster is an Oracle User in which case you could try and use UPPER(), LOWER() or INITCAP() functions to achieve your result.

Something like this might help :

Code:
SELECT * FROM tbl WHERE UPPER(myfield) LIKE '%SMITH%'
 
Thank you both for your very quick replies, I am indeed using oracle and using the UPPER() function worked immediately.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top