Like for loop in any language, the for loop component in SSIS has three for loop parameters:
InitExpression, EvalExpression, AssiognExpress.
Step1: create a new variable: Counter, int;
Step2: Drug and drop a for loop component, set the properties:
Step3: Drug a ‘Script’ component into the for loop, codes: we’ll add 1 every time.
Dts.Log("Counter: " + Dts.Variables("User::Counter").Value.ToString, 0, emptyBytes)
Dts.Variables("User::Counter").Value = CInt(Dts.Variables("User::Counter").Value.ToString) + 1
run, the package, check the log:
User:ScriptTaskLogEntry,…,25/10/2012 6:02:51 PM,25/10/2012 6:02:51 PM,0,0×00,Counter: 0
User:ScriptTaskLogEntry,…,25/10/2012 6:02:52 PM,25/10/2012 6:02:52 PM,0,0×00,Counter: 2
User:ScriptTaskLogEntry,…,25/10/2012 6:02:52 PM,25/10/2012 6:02:52 PM,0,0×00,Counter: 4
Ref: http://www.julian-kuiters.id.au/article.php/ssis-how-to-configure-for-loop-control
SSIS: Logging message in Script task <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.