I am using BCP utility to import a .csv
file. One of the columns has a value separated by comma but its enclosed in doubled quotes. BCP tools is unable to detect it and is incorrectly uploading data to my table.
Here is a repro:
CREATE TABLE [dbo].[test_temptable]
(
--[ID] [int] IDENTITY(1,1) NOT NULL,
[Column1] [varchar](100) NULL,
[Column2] [varchar](100) NULL,
[Column3] [varchar](100) NULL,
/*PRIMARY KEY CLUSTERED ([ID] ASC)
*/
)
ON [PRIMARY]
GO
Test data in inputData.csv
file:
value1,"test,test",value3
When I run the bcp command it works
bcp "testDB.dbo.test_temptable" in c:\temp\test\inputData.csv -c -t, -T -S "testDBServer" -e c:\temp\test\error.csv
1 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1 Average : (1000.00 rows per sec.)
However data in table is incorrect:
Column2 should have been test, test and column 3 value3.
What am I doing wrong? Any pointers? Thanks all.