Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bulk Upload: "unexpected end of file" on new server

I am trying to do a bulk upload in one table in our sql database. This query was running good before, when we had the database on different server, but now on the new server I am getting an error. Here is all I have: sql bulk import query:

BULK
INSERT NewProducts
FROM 'c:\newproducts.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO

And the errors I am getting are:

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

Thanks for any help in advance.

like image 830
Laziale Avatar asked Mar 29 '11 16:03

Laziale


1 Answers

For anybody else who comes across this question looking for an answer, this error also happens when the number of columns in your CSV file don't match the columns of the table you're doing the bulk insert into.

like image 138
justanotherguy Avatar answered Sep 22 '22 23:09

justanotherguy