views:

201

answers:

1

How do you programmatically add an SSIS ForEachLoop?

We are limited to SQL Server 2005.

I'm having trouble adding the following properties:
ForEachEnumerator
CollectionEnumerator
Directory
FileNameRetrieval
FileSpec
Recurse

My code format looks like this:

Microsoft.SqlServer.Dts.Runtime.Executable executable = aSequence[0].Executables.Add("STOCK:ForEachLoop");
((Microsoft.SqlServer.Dts.Runtime.ForEachLoop) executable).Name = "a for each loop";

Thanks for any help in advance.

A: 

Did you take a look at this MSDN sample?

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.foreachloop.foreachenumerator.aspx

It configures For Each Item enumerator, but can be easily adoped for others

Michael