Quantcast
Viewing all articles
Browse latest Browse all 24688

Error handling with IF clause

I have a stored procedure which has a IF clause at the end i.e. at the end it has

IF

CONDITION

BEGIN STATEMENT1

END

ELSE

BEGIN STATEMENT2

END

I use this stored procedure in SSIS Execute SQL Task to store in variable. It didn't raise an error but executed succesfully in the SSIS package whereas in SSMS I got statements like this when executed.I am assuming the task could not catch the error because of the IF clause. Is there a way I can fail the task if I encounter these errors?

(1 row(s) affected)

Msg 8152, Level 16, State 14, Procedure usp_PMAXML, Line 103

String or binary data would be truncated.

The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)

I am assuming the task did not fail because of the IF clause. Is there a way I can fail the task when


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>