sql server - Search for Accented Characters -
i've been looking around , i've found lot of information regarding creating searches accent insensitive. isn't i'm after.
some accented data causing problem in ui , i'm looking impact analysis.
is there elegant way search field any accented character, other unioning many different selects different characters in each?
the collate clause changes foo expression allow group separately
declare @t table (foo varchar(100)); insert @t values ('bar'), ('bár'), ('xxx'), ('yyy'), ('foo'), ('foó'), ('foö'); select foo collate latin1_general_ci_ai, min(foo collate latin1_general_ci_as), max(foo collate latin1_general_ci_as) @t group foo collate latin1_general_ci_ai having min(foo collate latin1_general_ci_as) <> max(foo collate latin1_general_ci_as);
or
select foo collate latin1_general_ci_ai, count(*) @t group foo collate latin1_general_ci_ai having count(*) > 1;
the first 1 gives actual values rather count. not if have several accented words
for sql server 2012, can use this
select * ( select first_value(foo) on (partition foo collate latin1_general_ci_ai order foo collate latin1_general_ci_as) safefoo, foo @t ) x safefoo <> foo
the 1st , 3rd rely on sorting of non-accent characters before accented characters
Comments
Post a Comment