SQL 服务器批量插入日期

SQL Server bulk insert with dates

我正在使用 SQL 服务器的 BULK INSERT 功能。

这是我正在使用的 .csv 中的测试数据:

2017-06-26,123456,101
2017-06-26,321482,73
2017-06-26,90139,10

当运行:

bulk insert testTable from 'c:\ml\data\test.csv'

我收到以下错误:

Msg 4832, Level 16, State 1, Line 3
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 3
The OLE DB provider "BULK" for linked server "(null)" reported an error. The 
provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 3
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

要导入分隔文件,您必须告知行终止符和列

尝试执行此操作。

bulk insert testTable 
from 'c:\ml\data\test.csv' 
WITH(FIELDTERMINATOR=',',ROWTERMINATOR='0x0a',CODEPAGE=1252)