Geeks Talk

Prepare for your Next Interview




match string using sql query...

This is a discussion on match string using sql query... within the SQL forums, part of the Databases category; 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 ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-11-2007
Contributing Member
 
Join Date: Sep 2006
Location: bangalore, india
Posts: 1,007
Thanks: 0
Thanked 76 Times in 64 Posts
psuresh1982 will become famous soon enough
match string using sql query...

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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-11-2007
Contributing Member
 
Join Date: Apr 2007
Location: bangalore
Posts: 46
Thanks: 0
Thanked 9 Times in 9 Posts
reetasharma108 is on a distinguished road
Re: match string using sql query...

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
Reply With Quote
  #3 (permalink)  
Old 05-11-2007
Expert Member
 
Join Date: Nov 2006
Location: Hyd-IND
Posts: 523
Thanks: 1
Thanked 55 Times in 46 Posts
sutnarcha is on a distinguished road
Re: match string using sql query...

This will work

SELECT * FROM table_name WHERE Upper(column_name) LIKE Upper(search_string);
__________________
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.

-sutnarcha-
Reply With Quote
  #4 (permalink)  
Old 05-14-2007
Contributing Member
 
Join Date: Sep 2006
Location: bangalore, india
Posts: 1,007
Thanks: 0
Thanked 76 Times in 64 Posts
psuresh1982 will become famous soon enough
Re: match string using sql query...

Thanks guys...That is working fine..

---------------------
suresh
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Difference between String.Convert Vs String.ToString jbanx C# 6 03-24-2008 01:02 PM
String and StringBuffer ramesh_etta Java 4 03-31-2007 09:25 AM
Getting exact recognition string JobHelper Rational Robot 0 01-06-2007 01:32 AM
Microsoft CRM : Tailor activities to match your user's tasks Jim.Anderson Microsoft CRM 0 09-27-2006 07:39 AM
String into Long norman C and C++ 2 07-13-2006 10:51 PM


All times are GMT -4. The time now is 01:28 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved