COPY INTO error caused by non-ASCII characters

Hans Boëtius 21 Reputation points
2022-12-08T16:42:38.993+00:00

Hello,

I get an error message when executing the COPY INTO statement. The error message is caused by some non-ASCII characters in my file.

The file that I want to process has only a few (32) records. It has a column with a customer name in it. Three records have non-ASCII characters, and only one record is causing the issue.
This record has value TÜV Süd as customer name. If I change TÜV Süd to TUV Sud then the COPY INTO statement runs successfully.
That is strange, because there are two other records with non-ASCII characters. One record has Gebrüder as (part of the) customer name and the other has Österreich as (part of the) customer name.

My statement looks like:
COPY INTO [Schema].[Table]
FROM 'https://******************/input_data/storage_vlde/'
WITH
(
FILE_TYPE = 'CSV'
, FIRSTROW = 1
, DATEFORMAT = 'ymd'
, ENCODING = 'UTF8'
)

The error message is "Bulk load data conversion error (truncation) for row starting at byte offset 641, column 4 (COUNTRY_CD) in data file /*************/input_data/storage_vlde/CPS_Storage_VlDE_202209.csv."

Any suggestions on a possible solution?

Regards, Hans

268675-image.png

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,378 questions
{count} votes

Accepted answer
  1. Bhargava-MSFT 31,261 Reputation points Microsoft Employee Moderator
    2022-12-12T21:16:47.627+00:00

    Hello @Hans Boëtius ,

    After further investigation, we found out the file you shared is not in UTF-8 format. We support only UTF encoding for Synapse SQL. You need to convert it to UTF to load it into Synapse SQL.

    I converted the file to UTF-8 by opening it in Notepad and changing the “Encoding,” as shown in the below screenshot.

    After that, I successfully loaded it into Synapse SQL using COPY INTO 269720-example01-original-utf8.txt.

    Attached is the converted file here for your reference.

    269811-image.png

    269738-image.png

    ------------------------------

    • Please don't forget to click on 130616-image.png and upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.