1

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!

Henry
  • 17
  • 4

1 Answers1

0

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.

Hogan
  • 69,564
  • 10
  • 76
  • 117
  • I was afraid of that. I'm unable to ask the vendor to trim the field down. I can't increase the column in SQL, as the field can contain 4,294,967,295 characters. I can't even resolve this through a SSIS package that I know of. Any ideas how I can make the data smaller in that field? – Henry Apr 05 '21 at 17:00
  • Never mind, I was able to resolve this in my SSIS package. Thank you! – Henry Apr 05 '21 at 17:27
  • @Henry -- that should be able to fit in a varchar(max) these days – Hogan Apr 07 '21 at 04:18