Chinese Character is not displaying correctly - sql-server

I am using openrowset to import data from sql server to another sql server. One of the column data is a chinese character. When i successfully import to my sql server, the column data which is chinese character show weird sign on my table. The data type for the column from the external is varchar where the data type for the column from my side is nvarchar.
Is there any way i can do so that the data can be display properly?
P.S. The weird character show is °»´ú³q¹DÂ_½u

Related

SSIS does not recognize Arabic Characters

My source SQL database contains Arabic characters and the column is an Xml data type. I am trying to get the data flown from source sql to destination sql db. However, when the data flow happens, the column which contains Arabic characters turns into gibberish (unrecognizable characters - not question marks).
How do I transition data correct from the source table to destination table. I have tried using Collate Arabic_CI_AI_KS_WS and used data conversion to add NTEXT and it's still not working.
Appreciate any leads to the direction in resolving this issue.
Thank you

How to see Arabic characters entered into SQL Server instead of?

I have a client who inserted some Arabic text into SQL Server database column. Now the text displays as ????? only.
I know that this is related to collation and that he should have modified the collation of SQL Server before entering his data. Also I know that he should have used nVarchar, instead of Varchar in his column.
How can I retrieve the data entered in his column or convert it into Arabic from ???? since the data is already entered and we need to convert it.
Thanks in advance.
Here are some basic rules which you may want to keep in mind. While storing Unicode data, the column must be of Unicode data type (nchar, nvarchar, ntext). Another rule is that the value must be prefixed with N while insertion like the below.
INSERT INTO TBL_LANG VALUES ('English',N'I am American')
INSERT INTO TBL_LANG VALUES ('Tamil',N'நான் தமிழன்')
If the data inserted in the correct manner, then you will get the correct response.
As well have a look at the link.
Convert “???? ??????” in to arabic language

Exporting a VARCHAR(MAX) Field from SQL to Excel in SSIS

I'm creating a SSIS Package to export Data from a SQL Server Table into an Excel Sheet. My Table has one column of datatype VARCHAR(MAX). And this column can have data as big as 30,000 characters sometimes. So I used a Data Conversion block to convert that column's DataType from it's original datatype text stream [DT_TEXT] to Unicode text stream [DT_NTEXT]. But when I execute the Package, I get this error An error occurred while setting up a binding for the "MyColumnName" column. The binding status was "DT_NTEXT".
I googled a lot but I couldn't get an answer to my problem. I'd appreciate all the help that I could get.
You can skip the data conversion task and just force the type when you extract from SQL Server SELECT CAST(MyBigColumn AS nvarchar(max)) As MyBigColumnUnicode but you're going to run into the problem that a cell in Excel cannot hold 100k characters.
Total number of characters that a cell can contain: 32,776
Excel specifications and limits

Collation , convertion and importing from ssis with german chars

My table is in SQL and contains only nvarchar columns.
The columns collation is set to Latin1_General_CI_AS . I want to import from SSIS, using flat file connection, some data that contains german charachters like Ö, Ü, etc.
In the flat file connection manager i have set the Code page:65001 (UTF-8) and the locale Germany, like in the attachement below and in the preview i have the data accordingly (Ex: Nürnberg).
However, when I execute the task and check the data in SQL table , it appears Nürnberg.
Am I missing something in this process?
I am assuming that your file is not Unicode. Since you get the "cannot convert between unicode and non-unicode string data types." error when using the 1252 ANSI code page, and you can change the datatype of your columns. I would just convert them to varchar. Since varchar is not Unicode the error should stop occurring.
The alternative would might be to do some thing like this:
Import Package Error - Cannot Convert between Unicode and Non Unicode String Data Type, but I think it would be easier to use varchar columns.

How can I recover Unicode data which displays in SQL Server as?

I have a database in SQL Server containing a column which needs to contain Unicode data (it contains user's addresses from all over the world e.g. القاهرة‎ for Cairo)
This column is an nvarchar column with a collation of database default (Latin1_General_CI_AS), but I've noticed data inserted into it via SQL statements containing non English characters and displays as ?????.
The solution seems to be that I wasn't using the n prefix e.g.
INSERT INTO table (address) VALUES ('القاهرة')
Instead of:
INSERT INTO table (address) VALUES (n'القاهرة')
I was under the impression that Unicode would automatically be converted for nvarchar columns and I didn't need this prefix, but this appears to be incorrect.
The problem is I still have some data in this column which appears as ????? in SQL Server Management Studio and I don't know what it is!
Is the data still there but in an incorrect character encoding preventing it from displaying but still salvageable (and if so how can I recover it?), or is it gone for good?
Thanks,
Tom
To find out what SQL Server really stores, use
SELECT CONVERT(VARBINARY(MAX), 'some text')
I just tried this with umlauted characters and Arabic (copied from Wikipedia, I have no idea) both as plain strings and as N'' Unicode strings.
The results are that Arabic non-Unicode strings really end up as question marks (0x3F) in the conversion to VARCHAR.
SSMS sometimes won't display all characters, I just tried what you had and it worked for me, copy and paste it into Word and it might display it corectly
Usually if SSMS can't display it it should be boxes not ?
Try to write a small client that will retrieve these data to a file or web page. Check ALL your code if there are no other inserts or updates that might convertthe data to varchar before storing them in tables.

Resources