SQL server 2014 and VS 2013 - BuilInsert task - truncate a field data of a CSV file and insert it to SQL table.

  • Hello everyone,

    To move data from roughly 50 CSV files in a loop to SQL tables (table per CSV file), I've used BulkInsert task in For each loop container.

    Please know, for all different columns of all CSV files, the filed length was specified as varchar(255).

    It worked well for the first 6 files but on 7th file, it has found the data in one of the columns of CSV file, which exceeds the limit of 255 characters. I would like to truncate the data and insert the remaining data for this column. In other words, I would like to insert first 255 characters into table for this field and let the package execute further.

    Also, if I would use SQLBulkCopy in Script task, will it be able to resolve this problem? I believe, I would face the similar problem over there too. Although, would like to get confirmation for the same from experts.

    Can you please advise how to get rid of this truncation error?

    Any help would be greatly appreciated.

  • Can you please advise how to get rid of this truncation error?

    Why should you have to code around this?

    Speak to whoever created the file and explain that it violates the spec. Then ask them to either

    1) Create a revised file spec, or

    2) Create a version of the file which conforms to the spec.


Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply