gk3391
gk3391

Reputation: 13

Does Db2 support “accent insensitive” collations?

In Microsoft SQL Server, it's possible to specify an "accent insensitive" collation (for a database, table or column). Is this possible in Db2?

Upvotes: 1

Views: 869

Answers (1)

Mark Barinstein
Mark Barinstein

Reputation: 12299

Look at the Unicode Collation Algorithm based collations article. Collating sequence is specified at the database creation time and can't be changed.

See the 'COLLATE USING locale-sensitive-collation' clause of the CREATE DATABASE command.

There is no way to specify collation sequence at the table or column level, but you can use the COLLATION_KEY_BIT function to compare string expressions.

select 
  case when c1=c2 then 1 else 0 end r1
, case when COLLATION_KEY_BIT(c1, 'CLDR181_EO_S1')=COLLATION_KEY_BIT(c2, 'CLDR181_EO_S1') then 1 else 0 end r2
from table(values ('Café', 'Cafe')) t(c1, c2);

R1 R2
-- --
 0  1

If your database had CLDR181_EO_S1 collation, the result in the 1-st column would be 1.

Upvotes: 1

Related Questions