Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 search problem with accents

Author  Topic 

mike13
Posting Yak Master

219 Posts

Posted - 2013-07-15 : 10:01:46
Hi All,


i want to search in the DB and i search for: claudio

but in the DB it is Cláudio

this is one example but there are many others, is there a way so i can search for without that accents interfering ?

thanks a lot,

Mike

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-15 : 11:34:31
Force an accent-insensitive collation. See the example below:
CREATE TABLE #tmp(NAME NVARCHAR(32));
INSERT INTO #tmp VALUES ('Cláudio'),( 'claudio');

SELECT * FROM #tmp WHERE
NAME COLLATE Latin1_General_CI_AI = 'claudio'

DROP TABLE #tmp;
Go to Top of Page

mike13
Posting Yak Master

219 Posts

Posted - 2013-07-15 : 11:47:47
thanks, would this work with german and Danish etc?
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-15 : 12:14:12
German and Danish and other languages that use accents would/should have their collation set to an accent sensitive collation. For example SQL_Latin1_General_CP1_CI_AS. When you force the collation to accent-insensitive, it should work as in the example I posted even in those languages. However, that is an educated guess - I don't have sufficient experience with internationalization and localization in SQL Server to comment on the nuances that you might run into.
Go to Top of Page
   

- Advertisement -