problems with BCP import

  • Hi.

    I'm trying to import csv file into a table using BCP and format file.

    Everything is working and I can see the data in the table.

    I do have one problem though. It seems that when BCP reached the end of the file, it doesn't stop the import process.

    Any idea how to get rid of this error message?

    Thanks.

    C:\Users\XXX\Desktop>bcp [XXX].[dbo].[XXX] in "\\temp\load.csv" -T -F2 -SXXX -f "\\temp\formatload.fmt"

    Starting copy...

    SQLState = S1000, NativeError = 0

    Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in BCP data-file

    264 rows copied.

    Network packet size (bytes): 4096

    Clock Time (ms.) Total : 47 Average : (5617.02 rows per sec.)

  • Check that the last line of the file has the CR/LF terminator (or whatever your line terminator is).

  • Hi,

    I had the same issue...

    When I did import into a new table then one of the column was empty for which my bcp was failing as it was inserting null values in a not null column.

    I used instead of BCP Bulk Insert

    BULK INSERT db_processor..breakdown FROM '\\myserver\D\processor1\staging_breakdown.txt'

    WITH (

    DATAFILETYPE = 'char',

    FIELDTERMINATOR = '\t',

    ROWTERMINATOR = ''

    )

    This worked perfectly..

    I really wasted my half day just to solve the BCP issue..

  • I have the same problem when I try bcp into Azure db. I have same table on my local server and on Azure. I bcp out of my local table into a file. and use this file to bcp into the table in Azure. I get :

    SQLSTATE = S1000, NativeError=0

    Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in BCP data-file.

    But if I use the same file to bcp into another local table, it goes through without any problem.

    Does anyone have any suggestions?

    Thanks!

  • Add to the last post. Also I just tested using the same data file to bcp into another table on Azure. It went through using the same command. There must be something behind the table causing the error even though I dropped the table and recreated it. The problem is still there.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply