Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

BCP Unexpected EOF encountered

Posted on 2009-06-30
4
Medium Priority
?
2,704 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

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 40

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

715 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