SQL – How to search with accented characters

The following T-SQL for Microsoft  SQL Server shows how to search for accented text without having to use the accented characters in the search term.

For example, if we had a table with the following data

Last_Name
Bekes
Békés

And the search for all last names of “bekes” was used – it would only the return one.

Instead you can use COLLATE to force a collation type – allowing your search to ignore accents.

For example:

SELECT Last_Name
WHERE Last_Name = 'bekes' COLLATE SQL_Latin1_General_Cp850_CI_AI

Which will return both Bekes and Békés.

For more information on how this words see: https://gertjans.home.xs4all.nl/usenet/microsoft.public.sqlserver.programming/Collation.html

 

Was this article helpful?

Related Articles