Solved

BCP Unexpected EOF encountered

Posted on 2009-06-30
4
2,477 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 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
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.

828 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