Foreach Loop From Variable Enumerator

Play Foreach Loop From Variable Enumerator
Sign in to queue


This Video Tutorial illustrates how to use From Variable enumerator to loop through an array list.

From Variable provides ability to loop through an array that filled from a script task. Collection structures such as Array and ArrayList can be loaded into an Object type variable in the SSIS package, and then Foreach Loop with From Variable Enumerator can loop through the variable.

In this sample we use From Variable Enumerator for following scenario:

Source CSV files come into a source directory. we want to load data from each source file into a database table, and then move that file into the archive folder. But we want to do the data load for only new files.

We use a script task to find new files based on System.IO namespace objects, and then we will load new file pathes into an array list, then the array list will be loaded into an Object type varaible of the package. Finally we use a Foreach loop with From Variable to loop through items of that array list, and load new files into the database table, and then archive them.



Download this episode

The Discussion

Add Your 2 Cents