473,700 Members | 2,631 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to search with Accent Insensitive and Case Insensitive

Hi all,

I have an easy question. I have a table with names, for example

name
--------
José
José
Albert
ALBERT

and I want to search in this table, using the "like", no matter has
accent, or case letters

For example:

like '%Jose%' I need to retrive both Jose and José

and the same for '%albert%' I need to retrieve ALBERT and Albert.

How can I do this?
Must I set an specific collation in table,..or something

Thanks

Alberto

and I use the "like" to search
Nov 30 '07 #1
3 7066
Gordowey wrote:
Hi all,

I have an easy question. I have a table with names, for example

name
--------
José
José
Albert
ALBERT

and I want to search in this table, using the "like", no matter has
accent, or case letters

For example:

like '%Jose%' I need to retrive both Jose and José

and the same for '%albert%' I need to retrieve ALBERT and Albert.

How can I do this?
Must I set an specific collation in table,..or something

Thanks

Alberto

and I use the "like" to search

Case insensitivity is easy. Just add a column or columns that are an
uppercase or lowercase version of the name column(s) and search on that.
This could be a generated column using upper, ucase, lower or lcase. It can
also be indexed and if you use a resonable statement will not result in a
table scan.

Accents are more difficult. At least in a UTF-8 database the accented
characters are multibyte. Translate will not translate between single and
multibyte characters. I believe that you may have to write a stored
procedure to monocase and strip the accented characters for insertion
update and search. I have not tried this but think that it might work with
Java or C.

Maybe somebody else knows a better way
Colin

Dec 1 '07 #2
On 1 dic, 22:17, Colin Booth <colinsbo...@gm ail.comwrote:
Gordowey wrote:
Hi all,
I have an easy question. I have a table with names, for example
name
--------
José
José
Albert
ALBERT
and I want to search in this table, using the "like", no matter has
accent, or case letters
For example:
like '%Jose%' I need to retrive both Jose and José
and the same for '%albert%' I need to retrieve ALBERT and Albert.
How can I do this?
Must I set an specific collation in table,..or something
Thanks
Alberto
and I use the "like" to search

Case insensitivity is easy. Just add a column or columns that are an
uppercase or lowercase version of the name column(s) and search on that.
This could be a generated column using upper, ucase, lower or lcase. It can
also be indexed and if you use a resonable statement will not result in a
table scan.

Accents are more difficult. At least in a UTF-8 database the accented
characters are multibyte. Translate will not translate between single and
multibyte characters. I believe that you may have to write a stored
procedure to monocase and strip the accented characters for insertion
update and search. I have not tried this but think that it might work with
Java or C.

Maybe somebody else knows a better way

Colin- Ocultar texto de la cita -

- Mostrar texto de la cita -
Thanks for your help. I appreciate !

I was trying to avoid to have to duplicate the information in the
tables, I mean

original aux
=============== ==
José Martín jose martin

is there another aproach?
thanks, Alberto
Dec 3 '07 #3
Gordowey wrote:
On 1 dic, 22:17, Colin Booth <colinsbo...@gm ail.comwrote:
>Gordowey wrote:
Hi all,
I have an easy question. I have a table with names, for example
name
--------
José
José
Albert
ALBERT
and I want to search in this table, using the "like", no matter has
accent, or case letters
For example:
like '%Jose%' I need to retrive both Jose and José
and the same for '%albert%' I need to retrieve ALBERT and Albert.
How can I do this?
Must I set an specific collation in table,..or something
Thanks
Alberto
and I use the "like" to search

Case insensitivity is easy. Just add a column or columns that are an
uppercase or lowercase version of the name column(s) and search on that.
This could be a generated column using upper, ucase, lower or lcase. It
can also be indexed and if you use a resonable statement will not result
in a table scan.

Accents are more difficult. At least in a UTF-8 database the accented
characters are multibyte. Translate will not translate between single and
multibyte characters. I believe that you may have to write a stored
procedure to monocase and strip the accented characters for insertion
update and search. I have not tried this but think that it might work
with Java or C.

Maybe somebody else knows a better way

Colin- Ocultar texto de la cita -

- Mostrar texto de la cita -

Thanks for your help. I appreciate !

I was trying to avoid to have to duplicate the information in the
tables, I mean

original aux
=============== ==
José MartÃ*n jose martin

is there another aproach?
thanks, Alberto

If you have many rows and the search is frequently used, duplication is
probably the fastest option. Functions such as translate will table scan
and I think will apply the translation to every row. This can be slow and
eat machines. Also %like% will not be good on large tables

Colin

Dec 4 '07 #4

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

Similar topics

1
3160
by: ajay.sonawane | last post by:
How can I find the wheather the occurance substring is main string in wide char provided that the compasion should be case insensitive.
10
9682
by: JohnR | last post by:
I have an arraylist of string values. I would like to search the arraylist to find the index of a particular string and I would like the search to be case insensitive. dim al as new arraylist al.add("one") al.add("two") dim x as integer = al.indexof("ONE") I would like this to find the match and return 0
2
2335
by: John | last post by:
Does anyone know how to how to performance case-insensitive search on XML data type in SQLServer 2005? Or I have to convert all the xml data to lower case before I store it? Thanks in advance. John
1
2170
by: ericswebber | last post by:
Case Insensitive Search with Sensitive Replace -------------------------------------------------------------------- Need a REGEX case insensitve search & replace where case of found string is mirrored in replacement string please. The above question is basically how does one perform a REGEX Case insensitve search and replace where the case of the found string is mirrored in the replacement string please.
1
1802
by: Rodrigo Costa | last post by:
Hi people... can anyone help on how to make a full-text search accent insensitive on a mdb database ? thx
1
35407
by: iksando | last post by:
Hello, I'm looking for solution in case insensitive search in MySql. Table exemple. CREATE TABLE `pozycje` ( `id` int(11) NOT NULL auto_increment, `eid` varchar(20) collate latin2_bin default NULL, `poz_nazwa` varchar(40) collate latin2_bin NOT NULL,
1
5521
by: benhoefer | last post by:
I have been searching around and have not been able to find any info on this. I have a unique situation where I need a case sensitive map: std::map<string, intimap; I need to be able to run a find on this map with a case sensitive AND case insensitive search. I need to be able to change this dynamically during execution. Is this possible? Any thoughts on this? I understand that I can make the map case insensitive, but that is not...
4
8174
by: bb | last post by:
Hi, void fun(const std::map<std::string,int>& m1) { // How to make a case insensitive search of this map without making a copy? } cheers.
0
5080
by: J. Cliff Dyer | last post by:
Please keep the discussion on-list. On Fri, 2008-09-05 at 15:36 +0200, Maric Michaud wrote: That does not get the same behavior as the OP's original solution. The OP's solution retrieves the first matching value only. Mine gets one arbitrary matching value, determined by the algorithm used for constructing the search dict (not specified in my solution). What the OP actually said was that he can't throw away the case. You assume...
0
8731
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8649
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9081
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4660
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3097
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2032
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.