Using unicode text in SQL Server 2008

I want to use unicode text on my site. I have an nvarchar (max) data type in a database to store data. When I save unicode text to the database, it works fine. However, when I try to perform some sql operation, the unicode text changes to "?????", for example, the query below

declare @unicodetext nvarchar(250) set @unicodetext='बन्द' select @unicodetext 

results

sqlunicode

What is the solution for this? Thanks

+6
source share
2 answers

Try

 declare @unicodetext nvarchar(250) set @unicodetext = N'बन्द' select @unicodetext 

You may have noticed that SQL Server uses N for any quoted string input when creating DDL scripts for you.

+10
source

you need to configure the database sort to sort that accepts this type of character, or you can add a matching clause of your choice as follows (google told me it was a Hindi character)

 declare @unicodetext nvarchar(250) set @unicodetext='बन्द' select @unicodetext COLLATE Indic_General_90_CI_AS 

that doesn't work, but I found this on BOL for SQL Server 2005:

4 Hindi comparisons are deprecated in SQL Server 2005 because this version of SQL Server uses the Windows 2000 collation table. The mapping still exists on the server, but it will not be supported in a future release of SQL Server and it will not appear in :: fn_helpcollations ().

5 Hindi and Lithuanian class mappings are deprecated in SQL Server 2005. These mappings still exist on the server, but they will not be supported in a future version of SQL Server, and they do not show up in :: fn_helpcollations ().

for 2008:

Hindi (India) - not available at server level

+1
source

Source: https://habr.com/ru/post/915377/


All Articles