SSIS FOR LOOP ends based on the value in a sql table

Viewed 81

I have created an SSIS package and it has a for Loop. I have a table in SQL Server that stores the time the package started. and a column for Remainging_Time(Minute), which is a countdown(in minutes) value. Now I want the SSIS For Loop to run until the Remainging_Time(Minute)value is 0.

Description in the pic:

enter image description here

1 Answers

I think your problem is two fold. First, the for loop is going to perform a task, then check the eval expression. If your counter is really just keeping track of elapsed time, it is possible that your time will expire while it is performing whatever tasks you assign.

If you don't care about that level of precision, I would store the Remainging_Time as a package variable, not in a database table. You can use a SQL task with expressions to update the value of your package variable as the last task inside your loop. It doesn't make sense to have to make DB call every time through the loop unless there is some external process that is updating that value in the DB... and if that's the case, that's not really a for loop, that's more of a while loop, in which case I'd do a script task instead of a for loop and handle whatever you're trying to do in there.

Let me know if that makes sense. I can add more detail if I know more about what you're trying to do.

Related