Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

BCP Unexpected EOF encountered

Posted on 2009-06-30
4
Medium Priority
?
2,748 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 41

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 41

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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

886 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