Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Show Eastern Letter(Chinese Character) on SQL Server/SQL Reporting Services?

I need to insert chinese characters in my database but it always show ???? ..

Example:

Insert this record.

微波室外单元-Apple

Then it became ???

Result:

??????-Apple

I really Need Help...thanks in regard.

I am using MSSQL Server 2008

like image 466
Crimsonland Avatar asked Sep 10 '10 03:09

Crimsonland


People also ask

How do I add Chinese characters to SQL database?

Answers. You'll need to ensure that your column is actually set to NVARCHAR(x) instead of VARCHAR(x). NVARCHAR columns can store unicode characters, which Chinese characters would be considered unlike VARCHAR columns which take up less space and cannot store unicode.

How does SQL Server handle Chinese characters?

You are not able to store Chinese characters in SQL Server with a collation of Latin1. You will need to choose a collation that allows Chinese characters - unicode is probably your best bet if you also are storing English text.


2 Answers

Make sure you specify a unicode string with a capital N when you insert like:

INSERT INTO Table1 (Col1) SELECT N'微波室外单元-Apple' AS [Col1]

and that Table1 (Col1) is an NVARCHAR data type.

like image 113
matt karp Avatar answered Nov 12 '22 05:11

matt karp


Make sure the column you're inserting to is nchar, nvarchar, or ntext. If you insert a Unicode string into an ANSI column, you really will get question marks in the data.

Also, be careful to check that when you pull the data back out you're not just seeing a client display problem but are actually getting the question marks back:

SELECT Unicode(YourColumn), YourColumn FROM YourTable

Note that the Unicode function returns the code of only the first character in the string.

Once you've determined whether the column is really storing the data correctly, post back and we'll help you more.

like image 43
ErikE Avatar answered Nov 12 '22 05:11

ErikE