Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BCP - Unexpexted EOF encountered in BCP data-file

7 views
Skip to first unread message

John Ward

unread,
Jun 19, 1997, 3:00:00 AM6/19/97
to

Hi,
I am having trouble using BCP to import into an SQL Server V6.0 table
on NT V3.5 using a data file with fewer columns than the table itself.

I am following the example on this in the 'MS SQL Server Administrator's
Companion' book, but I keep getting this error:

'Unexpected EOF encountered in BCP data-file'


My table is made up of 5 fields:
2 char;
1 int (4);
1 datetime (this is the field I am not importing).

However since my data file is binary I have declared the int field as SQLCHAR
(aswell as the datetime field) in the format file which I use when executing
BCP.

I have tried everything with the format file but to know avail.

PLUS:
I have tested a text file which contains values for all the fields in the table
and imported all of the fields successfully, however if I change

Host file data length to 0 and
Server column order to 0

for the datetime field, i.e. I am not importing into this field, I get the same
error, so I don't think it is any hidden character in the data file which may
be upsetting the import.

Is there some condition that I am missing?
Am I using the conflicting versions?
Can I import from a data file with fewer columns than table columns?

TIA,
John


Dave Glenn

unread,
Jun 19, 1997, 3:00:00 AM6/19/97
to

Yup, Common problem, I have done lots of work with Bcp and it is tricky but
does work if you set it up right. The eaisest way to deal with it is
1. Use a comma delimited format without a format file.
2. If you use a format file make all the datatype SQLVARCHAR this is due to
the fact the the format file has trouble reading dates, times and money in
any other formant the sql native.
3. Look at your source file in a good ascii editor (something you can see
the CR\LF in) I have gotten this error when the end of a row has many blank
spaces that I had not accounted for.
4. Make sure there is a CR\LF after the last line of data in your source
file.

Remember the syntex on the bcp line is case sensitive in some places.

Good Luck.

Dave , dgl...@connect3.com


Matthew Dodd

unread,
Jul 3, 1997, 3:00:00 AM7/3/97
to Dave Glenn
Sorry if I have already missed this, I'm catching the tail end of the
conversation.
Trying to load files directly into SQLServer using the VBSQL BCP
functions (tried everything else but performance is key), but I have
come to a dead end when attempting to load multiple files in to
successive rows.

After 7 rows SQLServer loses itself because there is no index. On top of
this, when I try to talk BCP into adding an index by appending unique
data to the file being loaded and separating columns with abitrary
strings, I get the same "BCP - Unexpexted EOF encountered in BCP
data-file".

Trying to load in to a table with a timestamp column yields the same
results too. Any ideas?

Thanks in advance.

Matthew Dodd
Phoenix Solutions

0 new messages