entity framework - How to use Unicode string for primary key in SQL Server -


I am having trouble entering a record with a primary key that only changes according to certain Unicode characters. For example, if I already have a record in the database with the primary key of "test" and I try to insert another record containing the primary "test + '\ U13A4' + '\ u13B4' + '\ u13B9' " I get a duplicate key error I am using EF5 with SQL Server 2012.

The primary key is defined as the nvarchar and the collation is set to SQL_Latin1_General_CP1_CI_AS . If the primary unicode characters are present then it can just take a look at the primary key, but if it is different in Unicode special characters (as in the example above), I get a duplicate key error when I insert it. How can you get this issue?

SQL_Latin1_CP1 matched does not meet all Unicode codepoints.

  Select n'test 'collate SQL_Latin1_General_CP1_CI_AS union n'test' + nchar (5028) + nchar (5044) + nchar (5049) - Result: 1 row   

Use new people after SQL Server 2008, for example

  select n'test 'collate Latin1_General_100_CI_AS Choose Union N'test' + nchar (5028) + nchar (5044) ) + Nchar (5049) - Result: 2 rows   

The Unicode character you are using comes within the 16-bit character limit, so the complementary characters are not yet in play Come on.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -