BUG: Bcp_exec Causes AV If Bcp_columns Is Less Than Table Columns

ID: Q199214


The information in this article applies to:

BUG #: 53584 (SQLBUG_70)
BUG #: 18490 (SQLBUG_65)

SYMPTOMS

When using the bulk copy program (BCP) application programming interface (API), the bcp_columns function is used to specify the number of columns to be accessed. However, when bulk copying out, if the bcp_columns value is set to less than the actual number of columns in the table or view, the bcp_exec function will experience an exception access violation (AV).

When using the Bcp.exe utility, the application will be shut down abnormally. Custom applications may exhibit different behavior based on implementations of structured exception handling.


CAUSE

BCP API attempts to map the total number of columns from the table to the column format information. If the bcp_columns setting is less than the total number of columns in the table, the memory area holding the format information for the columns is too small, and when accessed, causes the exception error.


WORKAROUND

To work around this problem, create a view containing the exact columns to be bulk copied out and ensure the bcp_columns is called with the same number of columns.


STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.0, 6.5, and 7.0.


MORE INFORMATION

This problem only affects BCP OUT operations, not BCP IN.

Additional query words: terminate terminates terminated bcped bcping


Keywords          : kbbug6.50 kbbug6.0 kbbug7.00 
Version           : winnt:6.0,6.5,7.0
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: February 12, 1999