If a file system task such as a rename fails, for example if the file does not exist, then this is considered an error by SSIS. This means the whole package fails. I can get aro
Here is one possible option. You can achieve the requirements mentioned in the question by changing the Precedence Constraint
after the File System Task to Completion
. Following example shows how this can be done. The example was created using SSIS 2008 R2
but holds true for previous versions as well.
Step-by-step process:
Create an SSIS package and create two variables as shown in screenshot #1. Assign some non-existent file path values to the variable.
On the package's Control Flow tab, place a File System Task, Script Task and Data Flow Task as shown in screenshot #2. Script Task and Data Flow Task are dummy here and the tasks are not configured to do any actions.
Configure the File System Task as shown in screenshot #3.
Screenshot #4 shows package execution and as expected the File System Task failed because the file paths don't exist. Also, the package stopped executing the tasks after the File System Task because of the error.
Right-click on the Precedence constraint arrow between File System Task
and Script Task
and select Completion as shown in screenshot #5. The arrow should turn from green color to blue color.
Screenshot #6 shows package execution after the precedence constraint change. The File System Task still failed but the other tasks continued to execute. Earlier
, the condition was to execute the Script Task only if the File System Task succeeded. Now
, the condition is to execute the Script Task after File System Task completes its execution (irrespective of Success or Failure).
If you would like to have the package take completely two different paths based on success/failure. You can do so as shown in screenshots #7 and #8. The red arrow indicates that the path will be taken on Failure of the File System Task and the green arrow indicates that path will be taken on Successful execution of the File System Task. I had a file created in the path C:\temp\Source.txt
before the execution of package shown in screenshot #7. Once the package executed, the file was renamed and the path was no longer. Hence, the package failed as shown in screenshot #8.
Hope that helps.
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
Screenshot #5:
Screenshot #6:
Screenshot #7:
Screenshot #8: