473,597 Members | 2,342 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 7047
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
3153
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
9665
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
2333
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
2162
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
1794
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
35406
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
5501
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
8157
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
5057
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
7969
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
7886
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
8272
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
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...
1
8035
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
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
5847
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
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.