Welcome to SqlServer-QA.net Sign in | Join | Help

SQL Server Storage Engine & Tools (SSQA.net)

SQL Server Tools includes storage engine that includes a complete set of graphical tools and command prompt utilities that allow users, programmers, and administrators. SSMS, SSRS, SSIS & SSAS are most commonly used tools.
Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file

When you use BCP then you would definelty get to see this error "Unexpected EOF encountered in BCP data-file". Not only that I have seen this as one of the frequently asked questions (FAQs) and for a moment you might be thinking why there is an end of file.

So better to check the match between the source file columns that are imported and the  fileds in the destination table in SQL Server, you might be stumped due to the Identity column which will be the first column on that table. As usual BCP process will try to insert a value that is not allowed due to the IDENTITY column configuration, also better to check what the field seperator.

The default seperator from a file would be tab seperated, in this case better to check your syntax for BCP

-t field_term

Specifies the field terminator. The default is \t (tab character). Use this parameter to override the default field terminator. For more information, see Specifying Field and Row Terminators in Books Online.

Also in this case better to work with formatfile option within BCP if the source columns never changes, whereas if the format of the file matches the table then it is simple to bcp the file without use of a format file. So always better to check under the source file and destination table properties whenever BCP bombs out. As usual the error on the subject is obscure and it will be useful to say 'data type mismatch or so' and for more information refer to Nigle's link on BCPUsingFormatFiles usage.

Posted: Tuesday, August 28, 2007 8:10 AM by SQL Master

Comments

SSQA.net - SqlServer-QA.net said:

When you use BCP then you would definelty get to see this error "Unexpected EOF encountered in BCP

# August 28, 2007 8:21 AM

Other SQL Server Blogs around the Web said:

When you use BCP then you would definelty get to see this error "Unexpected EOF encountered in BCP

# August 28, 2007 9:03 AM
Anonymous comments are disabled