Loops are a great tool that can be used in many programming languages. They provide a way to iterate over selected code repeatedly until it is conditionally told to stop. For example, in T-SQL a While loop is constructed so that a statement is repeated until a Boolean expression evaluates as false. The For Loop Container in SSIS works much the same way.
A common reason that you might use the For Loop Container is if you have a set of Control Flow tasks that need to be run until a condition has been met. For example, in the "Try It" section of this lesson a For Loop Container is used to check to see if a table has any rows of data. If the table has no records, then the loop continues to iterate until it finds that at least one row is present.
When you use a For Loop Container you first create a variable that the container can use to store an expression value of how many times the container has completed a run. The container runs three separate expressions at run time to formulate the loop. These three expressions require only one variable because the expressions change the same variable value each time they evaluate.
To configure the For Loop Container drag it on the design surface and double-click the top portion of the container to open the editor. Here you see the InitExpression, EvalExpression, and AssignExpression properties.
The InitExpression sets the initial value of the variable, so if you want the package to ...