Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Querying for ae matches æ in SQL Server / LINQ to SQL

When I try running...

SELECT * FROM Users WHERE Username = 'ae' it returns matches where the username is æ (ash character).

I was wondering if there's a way to support characters like the ash character but get an exact match for what I'm looking for.

I'd like to search for ae and get just ae, not ae and æ

I'm using SQL Server 2008 and SQL Server 2008 R2.

like image 637
Chad Moran Avatar asked Sep 29 '10 15:09

Chad Moran


1 Answers

This doesn't seem to happen with SQL collations

;with Users As
(
select 'æ' as Username UNION ALL SELECT 'ae'
)
SELECT *
FROM Users WHERE Username = 'ae' collate SQL_Latin1_General_CP1_CI_AS
like image 169
Martin Smith Avatar answered Oct 20 '22 15:10

Martin Smith