473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

string comparisons with case

Ike
If I have a field, `lastname`, and in the WHERE predicate of my SELECT
statement I want to test if it is LIKE 'Smith' without regards to case (i.e.
I want it to be true if it is smith or Smith or SMITH) how can I specify
this? Thanks, Ike
Oct 4 '06 #1
4 2592

Ike wrote:
If I have a field, `lastname`, and in the WHERE predicate of my SELECT
statement I want to test if it is LIKE 'Smith' without regards to case (i.e.
I want it to be true if it is smith or Smith or SMITH) how can I specify
this? Thanks, Ike
look at BINARY

Oct 4 '06 #2

By default, MySQL searches are not case sensitive . This means that if
you search with col_name LIKE 's%', you get all column values that
start with S or s.

If you want a column always to be treated in case-sensitive fashion,
declare it with a case sensitive or binary collation.

Ike wrote:
If I have a field, `lastname`, and in the WHERE predicate of my SELECT
statement I want to test if it is LIKE 'Smith' without regards to case (i.e.
I want it to be true if it is smith or Smith or SMITH) how can I specify
this? Thanks, Ike
Oct 5 '06 #3
Ike

"davie" <da***********@yahoo.co.ukwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>
By default, MySQL searches are not case sensitive . This means that if
you search with col_name LIKE 's%', you get all column values that
start with S or s.

But is that true with version >= 5.0 ?
Oct 5 '06 #4
RTFM
http://dev.mysql.com/doc/refman/5.0/...nsitivity.html
Ike wrote:
"davie" <da***********@yahoo.co.ukwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...

By default, MySQL searches are not case sensitive . This means that if
you search with col_name LIKE 's%', you get all column values that
start with S or s.


But is that true with version >= 5.0 ?
Oct 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Arvid Andersson | last post by:
Hello, I need to convert a string to a number, but the string can contain +,-,* and / as well as parenthesis. For example, if I have the string "30/(6+9)" I would like a function that returned the...
22
by: DJ | last post by:
Can someone tell me the library call that converts strings to lower case or retrns a new string that is lower case of the original, thanks im using <string> David
6
by: Maileen | last post by:
Hi, I have the following code : Function GetRequestType(ByVal EvDt As String, ByVal StPeriod As String, ByVal EdPeriod As String, ByVal TaskType As String) As Integer Dim strtest As String Dim...
4
by: Jim Langston | last post by:
Is there any builtin lowercase std::string compare? Right now I'm doing this: if ( _stricmp( AmmoTypeText.c_str(), "GunBullet" ) == 0 ) AmmoType = Item_Ammo_GunBullet; Is there anything the...
4
by: Sjaakie | last post by:
I need to replace parts of a string, in a collection deserialized from an XML file, with values from another collection. Is there another, more clever/faster/better, method than the loops below? ...
2
by: laura | last post by:
Hi, I'm looking for the algorithm which does the lowest number of comparison for the string matching problem (in the worst case). I know that the complexity is liniar in the length of the...
4
by: Mark Rae | last post by:
Hi, Is it possible to create a case-insensitive List<stringcollection? E.g. List<stringMyList = new List<string>; MyList.Add("MyString"); So that:
26
by: Neville Lang | last post by:
Hi all, I am having a memory blank at the moment. I have been writing in C# for a number of years and now need to do something in VB.NET, so forgive me such a primitive question. In C#, I...
12
by: Merk | last post by:
What are some alternatives to using .ToUpper() to perform case insensitive string comparisons? The reason I'm asking is that I'm comparing strings in a long loop, looking for equality; and I...
7
by: jpuopolo | last post by:
All: The String class has a CompareTo method, that compares to strings. Is there a similar method that performs case-insensitive comparisons? Thanks, John
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.