views:

32

answers:

1

Is there any way to initialize the value of two variables in the InitExpression of a For Loop Container in SSIS?

For example:

InitExpression:   @BeginDate = (DT_DBTIMESTAMP) "1/1/1900"; @EndDate = (DT_DBTIMESTAMP) "1/1/2007"
EvalExpression:   @BeginDate < GETDATE()
AssignExpression: @BeginDate = @EndDate; @EndDate = DATEADD("Month", 1, @EndDate)

Thanks

A: 

I don't believe that is possible. However, you could set the @EndDate variable definition as an expression and make it do these calculations in the expression. The For Loop Container would only increment the @BeginDate and the @EndDate would change as it changes.

Registered User
That would work except that I need @BeginDate to start at 1/1/1900 and then derive from @EndDate after that. I ended up using a Script Task before the loop and at the end of the loop instead. But thanks for your response.