# Databases > SQL match string using sql query...

## psuresh1982

My application is to get a search string from the user and return the records from the database which matches the search string..

I am using LIKE operator in the sql to get matching data..

But my problem is, the matching should be case insensitive..

For example, the data i required may be the Pen..

I have to get this value if i give any of the following possiblities as the search string..
p,pe,pen,PEN,Pen..

please help me with this..

-----------------------
suresh

----------


## reetasharma108

Hi,

U can try following query:-

select pen_name from table_name where upper(pen_name) like '%PEN%';
or
select pen_name from table_name where lower(pen_name) like '%pen%';

Reeta

----------


## sutnarcha

This will work  :EEK!:  

SELECT * FROM table_name WHERE Upper(column_name) LIKE Upper(search_string);

----------


## psuresh1982

Thanks guys...That is working fine..

---------------------
suresh

----------

