Solved

Case insensitive search

Posted on 2001-07-25
6
231 Views
Last Modified: 2012-05-04
HI all..

I am working with SQL 2000 and have a search problem. In the past I used to be able to do a search with out worring about case, but the server here seems to be case sensitive.

A simple query like

select * from staff
where
 Name LIKE 'g%'

will not return the name 'Graeme'. it wants a 'G'.

My Question is - how do I perform a case-insenitive search in my query?

Thanks
0
Comment
Question by:ggets
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:isond
ID: 6316672
Try

select * from staff
where
Name like '[Vv]%'

Darren.

0
 

Expert Comment

by:isond
ID: 6316676
Sorry that last post does not seem clear. The Vv looks like W.

Hear it is again.
Try

select * from staff
where
Name like '[Gg]%'

Darren.

0
 
LVL 3

Accepted Solution

by:
ibro earned 50 total points
ID: 6316746
Try this:

select * from staff
where
upper(Name) LIKE 'G%'

But if you want to imporove performance in cases like this, always store the names in upper (lower) case, so you will gain performance from index search.
hope this helps
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:mcmahon_s
ID: 6316747
Try:

SELECT * FROM STAFF
WHERE UPPER(NAME) LIKE 'G%'
0
 
LVL 4

Expert Comment

by:mcmahon_s
ID: 6316748
oops, ibro beat me to it
0
 

Author Comment

by:ggets
ID: 6318210
This works for me..

Thanks
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question