Microsoft KB Archive/199214

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

Article ID: 199214

Article Last Modified on 11/14/2003

-

APPLIES TO


 * Microsoft SQL Server 6.0 Standard Edition
 * Microsoft SQL Server 6.5 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q199214



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 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: kbbug kbpending KB199214

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.