BCP received a sqlstate error but task does not fail

I am imppporting a text file using BCP (in sql server 2k), and I put it ina run dos command action. The action is set not to ignore failures and the program exit code for success must be zero. When I run the action, it imppports a file with some garbage characters in the file. the action does not fail, it says completed, but if you look at the log iot says:

Starting copy...
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation

122 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total       16
 

how I make it translate a sqlstate=22001, nativeerror=0 from the odbc driver to an action fail in automise?

Hi Juan,

If you’re using Automise 3 you can add an ‘Output Monitor’ on the action and set it to ‘Fail action if match found’ using the search string ‘SQLState = 22001, NativeError = 0’. With Automise 2 you’ll need to use the actions ‘OnStatusMessage’ to monitor the output from the action and then if the string is found set the ‘ActionResult’ & ‘Continue’ values to False in the ‘AfterAction’ script event.

Regards,
Paul.