I am trying to import a comma delimited file (.CSV) into our SQL Server 2005 Database. I am trying to use BULK INSERT. The CSV file is a FEDEX report. It has fields such as "Mon, May 1, 2008". This report is automatically generated, thus I cannot alter its formatting. What this means for us is that we cannot make the delimiters anything other than commas(,). Basically we want the process to be totally automated and not make an employee change the formatting to fit our needs.
The files are all comma delimited and several of the fields contain commas. Of course, what happens on these rows is that the data gets spread out across more columns than it should and throws off the order of things.
So, my question is: is there a way to have the BULK INSERT ignore commas that are contained in data fields but still use the commas which delimit those data fields?
Here is what we have thus far:
BULK INSERT FEDEXTemp
FROM 'c:\test.txt'
WITH
(FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n')
GO
Thanks very much!
Start Free Trial