SFTP Remote File List - How to use result in Foreach Loop Container?

Dec 26, 2013 at 8:32 PM
Edited Dec 26, 2013 at 8:33 PM
Hello , Good night !

I am developing a SSIS project using the SFTP Task extension. However need to retrieve the list of files from SFTP server and stores them in a table in the database using the Foreach Loop Container task.

For this, I created a variable called VLIST , the type OBJECT and vFilename another call , the type STRING .

In return SFTP , use the VLIST variable to retrieve the list of files and use the ForEach Enumerator Enumerator FOREACH FROM VARIABLE step as a parameter and variable vFilename . Inside the ForEach , have an Execute SQL Task to insert in the table as the list is scrolled .

But the message that I get to run is this :

Error : 0xC001F009 at Package : The type of the value being assigned to variable " User :: vFileName " Differs from the current variable type . Variables may not change type during execution . Variable types are strict, except for variables of type Object .
Error : Sweeping 0xC001C012 at the list of files : ForEach Variable Mapping number 1 to variable " User :: vFileName " can not be applied .

Has anyone experienced this ? Can anyone help me ?

Thanks for listening !
Feb 27, 2014 at 1:06 PM
You cannot use it in the For Each loop, you can only use it in the Script Task (b/c the type of variable isn't supported by For each loop). See the example project on how to use it in the script task. You can write a simple loop in the script task to save the files in the database.