Solved

BCP Unexpected EOF encountered

Posted on 2009-06-30
4
2,362 Views
Last Modified: 2012-05-07
Hello Experts

I am having troubles with a BCP program. I am trying to upload a CSV file but I keep on getting an error message. Please see the code and error message below. I have also included the FMT file.

Please help.
COMMAND TO PROCESS

bcp tblTemp in "test.csv" -T -f"test.fmt"
 

MESSAGE ON SCREEN

Starting copy...

SQLState = S1000, NativeError = 0

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

0 rows copied.

Network packet size (bytes): 4096

Clock Time (ms.) Total     : 16
 

FORMAT FILE

9.0

3

1       SQLINT        0       4       ";"     1     ID                        ""

2       SQLCHAR       2       1024    ";"     2     Name                      SQL_Latin1_General_CP1_CI_AS

3       SQLCHAR       2       1024    ";\n"   3     Desc                      SQL_Latin1_General_CP1_CI_AS
 

FILE THAT I AM UPLOADING

1;a;b;

Open in new window

0
Comment
Question by:Quai_Gon_Jin
  • 2
  • 2
4 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 24748192
http://blogs.dotnetnerds.com/steve/archive/2005/10/17/25156.aspx

is ID an identity column?  Try turning that off and then inserting.
0
 

Author Comment

by:Quai_Gon_Jin
ID: 24748346
Sorry. No. ID is not an entity column. I am pretty sure that the problem has something to do with the fact that the delimiter is a semi colon and the row terminator is a new line \n
0
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 24748505
http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/4b794e09-ceae-4a3d-8920-fd52dc55cce0

Can you use BCP to export your data (eg: insert temporary in table) then find the correct format as text?
0
 

Accepted Solution

by:
Quai_Gon_Jin earned 0 total points
ID: 24748679
I tried that. When I do then I get a semi binary and semi text table. I am very confident that the problem is with the row seperator. In a binary hex editor it looks like 0A which I am assuming should be /n. However I am sure that the row terminator is not being read correctly as a LN
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now