Henry
Henry

Reputation: 17

How can I ignore bulk load data conversion error (truncation)

I have a file that is an extract from a MySQL table that I would like to in turn load to a SQL table (csv file) through a SSMS job. However, there is a field in the file that is defined as "LONGTEXT", which is way too long for a SQL table. I'd like to use BULK INSERT to load the file, but as expected, I'm getting an error "bulk load data conversion error (truncation)" on the "LONGTEXT" field. I don't mind truncating the field, so that I can get it loaded, but don't know how to ignore that specific error. Any ideas how to address this?

thanks so much in advance!

Upvotes: 1

Views: 739

Answers (2)

s6a6n6d6m6a6n
s6a6n6d6m6a6n

Reputation: 31

had the same error and was scratching my head over escape characters as the field had a '/' in it. The answer above gave a clue to check the length of the field coming in raw file. Sure enough, in the temp create, when changed from (50) to varchar, it worked.

Upvotes: 0

Hogan
Hogan

Reputation: 70523

Given what you said there are two ways to fix the problem.

  • Make the column bigger in the table you are inserting the data

  • Make the data smaller in the CSV file.

If you can't do one of those two things then you can't use BULK INSERT without getting the error.

Upvotes: 1

Related Questions