I have a script task with a validation. On failure, I wish to branch on a Execute SQL Task to send an email and then go to the step after the Scrip Task, and on Success, just go to the next step.
If Not (LowSize) Is Nothing Then Dts.Variables("User::strLowSize").Value = LowSize Dts.TaskResult = ScriptResults.Failure 'Go to step "Send Email SQL Task" then on Success 'Go to step "BulkInsert SQL Task" Else Dts.TaskResult = ScriptResults.Success 'Go to step "BulkInsert SQL Task" End If
Because it is successfull it does not go to next step. Is it because I cannot have a Failure branch and a success branch?
one way to do this is to add a boolean variable for notification and set it inside script task. then use expression and constraint as precedence constraint option to connect to execute sql and next task. for execute sql set expression as @variable == True and for next task set precedence condition from script task as @variable == False. for precedence from execute sql to next task set it only constraint option and on success. for the next task set multiple constraint option as OR
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/