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

ID: Q179657


The information in this article applies to:

BUG #: WINDOWS: 17758 (6.5)

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 this to be a problem in Microsoft SQL Server versions 6.0 and 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: tbl


Keywords          : SSrvBCP kbbug6.50 kbbug6.00 
Version           : WINNT:6.0 6.5
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: April 19, 1999