Article ID: 922660 - Last Review: November 2, 2007 - Revision: 1.3 The bcp utility does not return the correct value of the %ERRORLEVEL% variable on some errors in SQL Server 2000Bug #: 471243 (SQL Server 8.0) On This PageSYMPTOMSWhen you use the bcp utility to copy data between an instance of Microsoft SQL Server 2000 and a data file in a user-specified format, you may notice that the bcp utility does not return the correct value of the %ERRORLEVEL% variable on some errors. For example, you may insert rows that contain duplicate values in a specific column into a table that uses the UNIQUE constraint for that column. In this case, you receive an error message that resembles the following: Starting copy...
SQLState = 23000, NativeError = 2627 Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of UNIQUE KEY constraint 'IX_TableName'. Cannot insert duplicate key in object 'TableName'. SQLState = 01000, NativeError = 3621 Warning = [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. BCP copy in failed CAUSEThis problem occurs because the bcp utility does not set the value of the %ERRORLEVEL% variable for all the failures. STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. MORE INFORMATIONStep to reproduce the problem
| Article Translations
|

Back to the top
