将 csv 文件批量插入 SQL 服务器

Bulk Insert csv file into SQL server

我正在尝试使用批量插入将 csv 文件中的值插入 SQL。 csv 文件如下所示:

Fruit   Quantity    Cost
Apple   2            
Banana  1           [=11=].50 
Orange  9            

这是我使用的代码:

Create Table MyFruit 
    (
        Fruit varchar(50),
        Qty Int,
        Cost Float
    )


BULK INSERT MyFruit
FROM '\APPFS\user_home$\username\Temp\Fruit.csv'
WITH(
FIRSTROW = 1,
--FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

Select * From MyFruit

我不断收到以下错误:

Msg 4832, Level 16, State 1, Line 9
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 9
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 9
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

我正在使用 SQLServer2012

问题是服务器的安全设置。