Search code examples
filepathssisforeachenumerator

SSIS How to retrieve a file name when using a Foreach ADO Enumerator


Here is my problem. I have a first SQL task that return filepath into a Full result set (ie: \server\myfolder) I have then a variable , "USER::VAR_SQL" which is a System.Object.

then I connected my Execute SQL Task to a foreach loop Container and in " Collection" I selected "Foreach ADO Enumerator" and then as ADO object variable ""USER::VAR_SQL" in "Variable mappings" I added USER::filepath as variable.

Now, How can I loop on each USER::VAR_SQL value and then enumerate each file *.txt in the folder? I cannot find the way to get access to the files in myfolder.

Thanks you in advance Manu


Solution

  • Currently, you are "shredding" the ADO resultset. You now need to do the same operation against the filesystem. Embed a foreach file enumerator inside the existing foreach ado enumerator and wire it up.

    A picture might be more informative enter image description here