c# - SQL Server 2008 and Unicode Character comparison -


It seems that SQL Server 2008 removes some Unicode characters while comparing two wires. Consider the following table:

  Make Table [DBO]. [Test] [Navigator] (50) Faucet, Contract [PKHTist] Primitive Closed ([Text] ASC)) And now if I have some lines with Unicode characters Insert the test value (N'it ᧠ ') into the test value of' this')  

I get a unique handicap exception , Even if the price is different. I am using default database collation here, which is SQL_Latin1_General_CP1_CI_AS

  violation of primary key constraint 'PK_Test' can not include duplicate key in item 'dbo.Test'  

Note that this is not for all Unicode characters, but only for a few characters, but I did not recognize which unicode range is actually problematic, for example, dingbat 0x2757 Removed from (❗) Ia is, but 0x2764 (♥) is not. I think this is due to having some new Unicode standard with 0x2757. So the question is, is SQL Server 2008 any way to work with these characters, or alternatively, I programmatically convert them (in C #, via unicode categories or something) Such a) can find out and remove them beforehand?

OK, a little more digging reveals that it is almost certainly due to the new character , Because it also works with the equivalent of SQL Server 2008 Latin collation, but works with older versions i.e., Latin1_General_100_CI_AS , but not with Latin1_General_CI_AS . To get the complete list of collation I used to use these strings correctly:

  IF OBJECT_ID ('Tempdb .. # T') tap drop table # t; IF OBJECT_ID ('Tempdb .. # V') Null drop table is not #V; Table # V Create (A NVRAR (50), B NVARAR (50)); INSERT # V (A, B) value (N'it ᧠ ', N'it'); Create table # t (collation VARCHAR (500), match bit); DECLARE @SQL NVARCHAR (MAX) = (SELECT N'INSERT #T (Collation, Match) SELECT '' '+ + Name +', Case when A = B collated '+ name +' then 1V to 0 From 'sys.fn_helpcollations () to' V '; path to XML (' ', type) Value ('.', 'NVARCHAR (max)'); Execute SP_executesql @ SQL; SELECT * FROM #T where match = 0;  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -