bcp and errorlevel checks
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.