I receive a set number of CSV files each day from a third party vendor. Their developers wrap the values within the fields in double quotes. There are times where the values contain commas (For example: "In memory of John Doe, may this donation..."). Even though the comma is within a set of double quotes, when attempting to bulk insert the files into SQL Server by way of a bulk insert command, everything after the comma is placed in the next field. This isn't a desired output.
My bulk insert script looks something like:
BULK INSERT dbo.Transactions_Raw_Temp
FROM 'C:\DataDumps\FileDelivery\Transactions.csv'
WITH (FORMATFILE = 'C:\DataDumps\Bulk_Insert\TransactionsImport.fmt',
BATCHSIZE = 5000,
ROWTERMINATOR = '\n',
MAXERRORS = 1,
FIRSTROW = 2);
I've asked the third party vendor to send pipe delimited text files instead but they cannot accommodate that request. The daily csv files are in excess of 600,000 rows, and growing, so manually processing each file is a bit of an exercise.