none
Raise Error from SSIS pkg

    Question

  • Can I raise an error form SSIS package component execute sql task and have the control re-direct to some other say mailing component and to send an email on certain condition 

    e.g.

    I have a below code in expression of Execute SQL Task which on status<>0 sets the variable @exit_pkg = 'True' and RaiseError as below and control is passed to a alternate component defined with precedence logic as on FAILURE and @exit_pkg = 'True' 


    IF @STATUS = 0 
    BEGIN
    	SELECT 'FALSE' AS Exit_Pkg
    	UPDATE  [Config1] SET [IN_USE] = 1
    END
    ELSE 
    BEGIN
    	SELECT 'TRUE' AS Exit_Pkg
    	--RAISERROR (15600,-1,-1,N' attempt was made to run the pkg in use');
    END 

    Neil


    • Edited by Neilcse Thursday, September 04, 2014 6:25 PM
    Thursday, September 04, 2014 6:24 PM

Answers

  • Then just add a constraint to check that the value of it. Double click the constraint line, and set it to be expression.
    • Marked as answer by Neilcse Friday, September 05, 2014 5:33 AM
    Thursday, September 04, 2014 10:03 PM

All replies

  • You could need to set the value of a variable in the query, then adjust the constraints to evaluate the variable.
    Thursday, September 04, 2014 7:01 PM
  • I am setting the values of the variables using below code with Result Set mapping in execute sql task

    SELECT 'FALSE' AS Exit_Pkg 
    SELECT 'TRUE' AS Exit_Pkg


    Neil

    Thursday, September 04, 2014 7:17 PM
  • Then just add a constraint to check that the value of it. Double click the constraint line, and set it to be expression.
    • Marked as answer by Neilcse Friday, September 05, 2014 5:33 AM
    Thursday, September 04, 2014 10:03 PM
  • Thanks I have expression and constrains on both the outputs, thanks its working now.

    Neil

    Friday, September 05, 2014 5:33 AM