Results 1 to 4 of 4

Thread: match string using sql query...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    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


  2. #2
    Contributing Member
    Join Date
    Apr 2007
    Answers
    46

    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


  3. #3
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    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-

  4. #4
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Re: match string using sql query...

    Thanks guys...That is working fine..

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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact