In the SSIS system, the control flow can often be encountered, such as you get a column of data, you need to loop the data and then do the appropriate operation, you need to use the loop, below, I will operate two loops, for loop and foreach Loop.
A, for loop
As you know, the usual writing for loops is this: for (var i = 0; i < i++) {//do sth;};
Here the bread contains three movements, the first to make the cycle, set the end of the cycle, cycle update values. Let's take a look at the corresponding action in the container for the loop.
Initexpression => Var i = 0
Evalexpression => I < 10
Assignexpression => i + +
In this comparison it is easy to understand the operation of the for container, we have to do such an operation, define a variable, each time let MessageBox pop-up such a value;
1, drag into the for container
2, add a @forloop int type variable in the variable window
3, follow figure 1 to operate the @forloop variable
4, add the Script task in the for window