UltraSmooth
Programmer
I'm trying to import a large csv file into a table.
Every field in the csv file is surrounded by double quotes and fields are separated by the ',' character.
When I execute the command
BULK INSERT temptable FROM 'D:\CSVData\importfile.csv' WITH (MAXERRORS=0,FIELDTERMINATOR = '","',ROWTERMINATOR = '\n');
I get the following error:
Server: Msg 4864, Level 16, State 1, Line 1
Bulk insert data conversion error (type mismatch) for row 1, column 1 (ADJUNIT).
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'STREAM' reported an error. The provider did not give any information about the error.
The statement has been terminated.
The first column is of type 'int' so I guess the command is parsing the first field as text.
What is the proper syntax for this command to handle the double quotes around the fields?
Thanks for any help.
Every field in the csv file is surrounded by double quotes and fields are separated by the ',' character.
When I execute the command
BULK INSERT temptable FROM 'D:\CSVData\importfile.csv' WITH (MAXERRORS=0,FIELDTERMINATOR = '","',ROWTERMINATOR = '\n');
I get the following error:
Server: Msg 4864, Level 16, State 1, Line 1
Bulk insert data conversion error (type mismatch) for row 1, column 1 (ADJUNIT).
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'STREAM' reported an error. The provider did not give any information about the error.
The statement has been terminated.
The first column is of type 'int' so I guess the command is parsing the first field as text.
What is the proper syntax for this command to handle the double quotes around the fields?
Thanks for any help.