How to export Japanese characters from SQL Server 2008 database to a text file?
-
02-06-2021 - |
Domanda
I have an odd problem. I need to export Japanese characters from a table to a raw text file. When I run the select statement in SQL, I am able to see the characters displayed correctly. However, when I run the SSIS package to export these values to a text file they are displayed as ?
's.
Data type of the field is NTEXT. Has anyone ran into this problem before?
SQL statement:
select cast(body as nvarchar(max)) as body from msgsMarket
In SSIS package's flat file connection manager, I have set the output encoding to use 932
Soluzione
This is not a solution but might probably help you to identify the problem in your case.
Created a sample SSIS package using SSIS 2008 R2 with UTF-8
and Unicode
encodings and the SQL Server data exported correctly to flat files.
Sample SQL data in the file. Description field was of data type NVARCHAR
. The sample was also tried by changing the data type of the Description field to NTEXT
and the flat files still exported correctly.
SSIS package was created with a data flow task with two outputs for UTF-8 and Unicode.
First flat file connection manager to generate flat file with encoding UTF-8.
Output file generated with UTF-8 encoding.
Second flat file connection manager to generate flat file with encoding Unicode.
Output file generated with Unicode encoding.