tags:

views:

125

answers:

1

I am selecting data from a table using FOR XML and outputting it to a file, then need to only FTP the file if the destination directory is empty.

using SSIS, how do i get the result back to base my next step on. If the destination file already exists then it should NOT be overwritten and the items in the transfer should not be marked as transferred.

If there is no file then the FTP action should confirm the file was transferred and then update the items so they are marked as being trasnferred.

I can figure out the SQL to get the list of items and handle the update but I really cant figure out how to get a response back from the SSIS FTP Task.

+1  A: 

First, I would check to see if the file exists in a script task in your control flow:

//have the file path stored in a variable that I have stored in a pkg configuration

if (File.Exists(this.Dts.Variables["file_path"].Value.ToString()))

{

 this.Dts.Variables["file_exists"].Value = true;

}

else

{

 this.Dts.Variables["file_exists"].Value = false;

}

I would then create 2 constraints that stem off the script task using expressions-one where @file_exists == false and have it send an email, log error, etc. and the other where @file_exists == true and then call your ftp task. I hope this helps.

rfonn