bcp and errorlevel checks

Published 12-17-2007 11:54 PM | jokiz

we have a number of batch scripts at work which executes sql-related tasks for each of our project releases.  last time, i incorporated errorlevel checks so we know if there was a problem with the execution and in order to abort the rest of the operations if something else has gone wrong. 

i was surprised this weekend when one the bcp operation failed but it continued to execute the latter commands.  it turns out that the errorlevel variable is not populated correctly by bcp version 8 which comes with sql server 2000 (see kb here).  Luckily, it was already resolved with bcp version 9 which comes with sql server 2005.

Filed under: ,

Comments

# online met Boskamp %2526 Willems Advocaten said on February 10, 2008 10:20 AM:

The proper way to track down this information is to use all means at your disposal.