UTF-16 / Unicode data storage in SQL Server

According to this , SQL Server 2K5 uses UCS-2 internally. It can store UTF-16 data in UCS-2 (with corresponding data types, nchar, etc.), however, if there is an extra character, it is saved as 2 UCS-2 characters.

This leads to obvious problems with string functions, namely that what is a single character is treated by SQL Server as 2.

I am somewhat surprised that SQL Server is basically only capable of handling UCS-2, and moreover, this is not fixed in SQL 2K8. I really appreciate that some of these characters may not be so common.

In addition to the features suggested in this article, any suggestions on the best approach to working with (damaged) UTF-16 string functions and data in SQL Server 2K5.

+5
source share
3 answers

SQL Server 2012 now supports UTF-16, including surrogate pairs. See http://msdn.microsoft.com/en-us/library/ms143726(v=sql.110).aspx , especially the "Extra Symbols" section.

So, one fix for the original problem is to adopt SQL Server 2012.

+5
source

Unicode; , , , . len() datalength(), . - len() , datalength() . - .

, , , .

: Books Online, unicode- , SQL Server 2000.

EDIT 2. , SQL Server Unicode - 0 (, , SQL Server .) SQL Server , , , . , -, SQL Server, CLR Unicode.

+2

- , :

"n" oracle (im running 9i) .net oracleclient, , sql ... N'string 'unicode , sql.

"work", : , . , /.

: http://forums.oracle.com/forums/thread.jspa?threadID=376847

, ORA_NCHAR_LITERAL_REPLACE - .

-2

All Articles