Unexpected EOF encountered in BCP

后端 未结 8 1697
无人及你
无人及你 2020-12-30 11:43

Trying to import data into Azure. Created a text file in Management Studio 2005. I have tried both a comma and tab delimited text file.

BCP IN -c -t, -r\\n -U -S

相关标签:
8条回答
  • 2020-12-30 11:56

    Open the CSV file in EXCEL and "save as" new CSV file

    0 讨论(0)
  • 2020-12-30 11:58

    If the file is tab-delimited then the command line flag for the column separator should be -t\t -t,

    0 讨论(0)
  • 2020-12-30 12:00

    "Unexpected EOF" normally means means the column or row terminator is not what you expect That is, your command line arguments for these do match the file

    Typical causes:

    • Unix vs Windows line endings
    • Text data containing your column delimiter (comma in actual data)
    • Or a mix of the two.

    SSMS should have nothing to do with it: it's the format (expected vs actual) that matters

    0 讨论(0)
  • 2020-12-30 12:00

    I think most of us prefer real-world examples than syntax hints, so here's what I did:

    bcp LoadDB.dbo.test in C:\temp\test.txt -S 123.66.108.207 -U testuser -P testpass -c -r /r

    My data was an extract from a Unix-based Oracle DB which was tab delimited and had an LF end of line character.

    Because my data was tab delimited I did not specify a -t parameter, the bcp default is tab.

    Because my row terminator was a LineFeed (LF) character, then I used -r /r

    Because my data was all being loaded into char fields I used the -c parameter

    0 讨论(0)
  • 2020-12-30 12:01

    Just an FYI that I encountered this same exact error and it turned out that my destination table contained one extra column than the DAT file!

    0 讨论(0)
  • 2020-12-30 12:06

    I every case that I have encountered this error, it ends up being an issue where the number of columns in the table do not the match the number of columns delimited in the text file. The easy way to confirm this is to load the text file into excel and compare the column count to that of the table.

    0 讨论(0)
提交回复
热议问题