• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Case Insensitve Search

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I was wondering how I can do a case-insensitive search
if the string is something like, "2222ab".
If I typed in "%a" or "%A" (which is a search using a wildcard), it should return 2222ab.
Any advice anyone?
Thanks.
-kd
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Convert "2222ab" and the search string to upper case and compare.
"2222ab".toUpperCase().indexOf(<Search String without the wild card>.toUpperCase()) > 0
Did i answer your question??

 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are looking for Database functions, you can convert both the search string and the compared string to uppercase(or lowercase):
"SELECT emp_name FROM emp WHERE UPPER(emp_desc) LIKE UPPER("%a%")
the above will return any employee that has an "a" or "A" in his description.
Jamie

[This message has been edited by Jamie Robertson (edited August 24, 2001).]
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
remember that if you do a function in the where clause on the indexed column, you will not get use of the index.
so hopefully your column is in all uppercase and you can just upper the user input, that way you can get the index
where emp_name like upper(u_name)

Dan
 
He baked a muffin that stole my car! And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic