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

10,520

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.

Share:
10,520
Laziale
Author by

Laziale

Updated on June 25, 2022

Comments

  • Laziale
    Laziale almost 2 years

    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.

  • Laziale
    Laziale about 13 years
    Brian, thanks for the help, but I checked for all that stuff, I did a test only with two rows and I still get the same errors
  • Brian Driscoll
    Brian Driscoll about 13 years
    Did you check in notepad? I've found that Excel is not really very helpful when it comes to tracking down extraneous whitespace.
  • Laziale
    Laziale about 13 years
    yes, in notepad is the same. no extra whitespace everything looks same, I don't know why I am getting that error
  • Stockburn
    Stockburn over 3 years
    I know this is a really old post but mate thank you for this, made me recheck.