2

I have a SSIS Package and the first task I have is a script task. it checks to see if a file exists if it does (=1) then it continues to next tasks how to I get it to go down a different route if file does not exist(=0)?

I have tried adding a completion arrow and a failure arrow but this is not correct

Hadi
  • 36,233
  • 13
  • 65
  • 124
sql2015
  • 591
  • 3
  • 13
  • 34

1 Answers1

0

Use the following steps

  1. Add a variable to the ssis package of type boolean
  2. if file exists set variable = true
  3. in the success arrow (double click on it) and choose constraint and expression option
  4. in the expression add @[User::variable] == True and add another success arrow with @[User::variable] == False

Read more at the following links:

Hadi
  • 36,233
  • 13
  • 65
  • 124
  • thanks this is what I did but I didn't realise you could have two success arrows. although it doesn't seem to be working 100% it correctly takes the right route down the arrow but where both arrows feed back into the flow it stops and doesn't error – sql2015 Nov 23 '17 at 09:02
  • Make sure that if you have two arrows connected to one component, if your need is that only one of these arrows is successful, you have to double click on it and choose `Logical Or` option. i added a new link to the answer. check it `Working with Precedence Constraints in SQL Server Integration Services` – Hadi Nov 23 '17 at 09:36