Groups | Blog | Home
all groups > sql server dts > september 2007 >

sql server dts : Foreach Loop Container does not iterate automatically


B NO[at]SPAM ns
9/19/2007 2:24:02 AM
Hi,

Another classic example of something silly I must be doing :(

I have a "Foreach Loop Container" which uses a "Foreach ADO Enumerator".
The object source is a recordset variable.

Inside the "Foreach Loop Container", a lot of things are happening - some
Execute SQL Tasks, Send Mail Tasks, Script Tasks and also a couple of
Sequence Containers.

Now, I am getting 2 records in the recordset, but, the "Foreach Loop
Container" executes just once.

Any Ideas?

Thanks in advance.
Regards,
Todd C
9/19/2007 6:00:01 AM
Hello B@ns:

By "recordset variable" I assume you mean type: Object ? How are you filling
that variable? I use an Execute SQL Task. I set the Result Set property to
Full Result Set (NOT Single Row).

HTH
--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


[quoted text, click to view]
B NO[at]SPAM ns
9/19/2007 7:00:03 AM
Hi Todd,

You are right, the recordset variable is of type System.Object.

I am filling this object in a Data Flow Task whose destination is a
Recordset Destination.

Mysteriously, I am not able to re-produce this error :(
Now, the Foreach Loop Container is indeed looping through all the records.
But, this makes me more worried.

Thanks again.

Regards,
B@ns

[quoted text, click to view]
Todd C
9/19/2007 7:18:03 AM
B@ns:

If you are using a DataFlow to populate the variable, then I assume that you
are doing some transforms to get it to its final values? If all you have is a
Source and RecordSet Destination, then you might consider replacing that
whole DataFlow with an Execute SQL Task using a SELECT statement and
FullResultSet. Might simplify your design a little.

Ahhhh, errors that fix themselves! Only in software! When my car breaks
down, it STAYS broken!
--
Todd C

[quoted text, click to view]
B NO[at]SPAM ns
9/19/2007 8:18:00 PM
Hi Todd,

I am not using any transformations, so your suggestion definitely holds good!
Thanks.

:) You are right again - this happens only in software. And it's dangerous.

Thanks and Regards,
B@ns

[quoted text, click to view]
AddThis Social Bookmark Button