Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 SSIS branch failure and success

Author  Topic 

infodemers
Posting Yak Master

183 Posts

Posted - 2012-09-14 : 08:53:36
Hi everyone,

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?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-14 : 10:32:32
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/

Go to Top of Page

infodemers
Posting Yak Master

183 Posts

Posted - 2012-09-14 : 11:02:01
Hi,
If I understand you correctly, it should look like the image at the following URL?
https://picasaweb.google.com/lh/photo/tlb7g11RvjrK3bZzYoWphNMTjNZETYmyPJy0liipFm0?feat=directlink
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-14 : 11:03:20
yep.only difference being first two arrows in green (on success) rather than on completion along with expression

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

infodemers
Posting Yak Master

183 Posts

Posted - 2012-09-14 : 11:41:15
Like This?
https://picasaweb.google.com/lh/photo/NVtWwU5TG8grxcUtw1YSgNMTjNZETYmyPJy0liipFm0?feat=directlink
Go to Top of Page

infodemers
Posting Yak Master

183 Posts

Posted - 2012-09-14 : 12:22:18
I got what you meant to say....It is now working !

Thanks again for helping me! ;-)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-14 : 16:36:06
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -