BUG: BCP Fails to Parse Format File If It Has White Space in Column Name (179657)



The information in this article applies to:

  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5
  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q179657
BUG #: WINDOWS: 17758 (6.5)
BUG #: 225622 (Shiloh_bug)

SYMPTOMS

When using the bulk copy program (BCP) to do BCP IN, BCP fails to parse a format file that was created during a BCP OUT. This problem occurs when the user responds to the prompts for each column if the source table was created with white space in the column names.

CAUSE

When a table is created with the SET QUOTED_IDENTIFIER option turned on and the table columns have embedded white space, the column names with the embedded white space are copied to the last column (column name) of a format file by BCP. On a BCP IN, these column names are incorrectly parsed because of the white space. The following error message is returned by BCP:
DB-LIBRARY error:
Incorrect host-column number found in bcp format-file.
This error is generated because BCP stops parsing the column name after it encounters the first white space. BCP then interprets the next word in the column name as the beginning of the next line and expects to find a column number for the data file.

WORKAROUND

To work around this problem, manually edit the format file to omit all white space characters from the last column in the format file (that is, characters 0x09-0x0D, 0x20).

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MinorLast Reviewed:2/14/2005
Keywords:kbBug KB179657