Wednesday, June 1, 2022

SSIS: export to csv flat file destination task: The code page on input column error 1252 and is required to be 65001

exporting data to flat files. We sometime see error for code page 1252   and is required to be 65001 or it can be vice versa.


ADDITIONAL INFORMATION:

Error at export data to csv [Flat File Destination [187]]: The code page on input column "..." (958) is 1252 and is required to be 65001.


Issue:

Data output from sqlserver by default (This can be updated to other compatible formats) come in ANSI - Latin file format i.e. 1252.  65001 is value for the unicode file (i.e. UTF-8)

The error caused in code pages because 1252 (i.e. Windows-1252) is output from SQL Server and 65001 (i.e. UTF-8) that your CSV file is expecting. 


Solution:

There are two solutions:

1) Select the file connection in SSIS --> Open the properties window and update the code page to the required value as below.



2) Update the SQL code to the unicode format i.e. convert / cast all fields to nvarchar

e.g. select CONVERT(nvhar(10),GETDATE()) DATE 

Popular Posts