SQL Server Bulk insert of CSV file with inconsistent quotes

It isn’t possible to do a bulk insert for this file, from MSDN:

To be usable as a data file for bulk import, a CSV file must comply with the following restrictions:

  • Data fields never contain the field terminator.
  • Either none or all of the values in a data field are enclosed in quotation marks (“”).

(http://msdn.microsoft.com/en-us/library/ms188609.aspx)

Some simple text processing should be all that’s required to get the file ready for import. Alternatively your users could be required to either format the file according to the se guidelines or use something other than a comma as a delimiter (e.g |)

Leave a Comment

tech