I am trying to automate an import of csv to a table. My issue is that my csv has the occasional speech mark in a couple of column when a comma is within the cell, this in turn is giving me an incorrect import.
Example of Inventory.csv
Computer Name,Manufacturer,Model,Service Tag,IP Address,Last Logon User,Warranty Expiry Date,Scan Status,OU Name
DEVICE1,"VMware, Inc.",VMware Virtual Platform,VMware-00 00 00 00 00,--,,,Success,VDi Critical Masters
DEVICE2,Dell Inc.,PowerEdge R510,45TERTT,10.10.10.1,admin,"Sun, Feb 22 2015, 12:00:00",Success,File Services
DEVICE3,Dell Inc.,PowerEdge R510,7HGDGSD,10.10.10.2,admin,"Sun, Feb 22 2015, 12:00:00",Success,File Services
DEVICE4,Dell Inc.,PowerEdge R310,TYUHHFG,10.10.10.3,Admin,"Sun, Feb 22 2015, 12:00:00",Success,File Services
DEVICE5,Dell Inc.,PowerEdge R510,VBNCGHJ,10.10.10.4,admin,"Sun, Feb 22 2015, 12:00:00",Success,File Services
DEVICE6,Dell Inc.,PowerEdge R210,JGDNFGN,10.10.10.5,admin,"Sun, Feb 22 2015, 12:00:00",Success,File Services
T-SQL Script
USE [DatabaseName]
DELETE FROM [tbl_Inventory]
BULK
INSERT [tbl_Inventory]
FROM 'D:\SQL\Collections\Inventory.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
--Check the content of the table.
SELECT COUNT([Computer Name]) As Entries
FROM [tbl_Inventory]
GO
Any ideas?