How to write an error message from an BCP operation to a log file and stop processing the batch file

Posted by Newbie on Stack Overflow See other posts from Stack Overflow or by Newbie
Published on 2010-03-29T04:51:52Z Indexed on 2010/03/29 5:13 UTC
Read the original article Hit count: 317

Filed under:
|

I have a BCP operation in a batch command file. when there is an error in the BCP Operation I need to stop the processing and write the err msg in the log file

I've used to -e option to write the error message during a BCP operation to a err file. The err file is getting created in the location but does not contain any error message written to it.

My BCP statement is like this.

BCP DbName.dbo.tableName In FileLocation -e Errorfile -S ServerName -T -c

Is there a way to get the error level and then stop the processing.

Appreciate quick help.

© Stack Overflow or respective owner

Related posts about bcp

Related posts about sql