Modify search to make it Accent Insensitive in SQL Server

collation, sql, sql-server-2005

Solution

You can make the search use whatever collation you want, e.g.

WHERE column COLLATE FRENCH_CI_AI LIKE '%something%' COLLATE FRENCH_CI_AI

However I suspect it will work better if you actually fix the column (which didn't happen when you changed the database collation). Leaving out any constraints and other dependencies, the short answer of how to fix this:

ALTER TABLE dbo.foo ADD newcol NVARCHAR(32) COLLATE FRENCH_CI_AI;

UPDATE dbo.foo SET newcol = oldcol;

ALTER TABLE dbo.foo DROP COLUMN oldcol;

EXEC sp_rename N'dbo.foo.newcol', N'oldcol', 'COLUMN';

Problem

I have a database which current collation is French_CI_AS, which means that searches are case insensitive, but accent sensitive. I had the impression that changing the collation of the database to French_CI_AI would solve my problem so I did it. However, I still can't make a simple search work Accent-Insensitive. I check and the table collation is French_CI_AI, which is probably because it was changed along with the database. Is there some way to make the search possible with Accent insensitive on all database ? Or is there any way to make a single seach that way ? I only have one or two Stored procedures that would need that so I could go that way to. In case it makes any differences, the datatype I look for are all nvarchar(n)s. Thanks

Original source