How to Avoid an Error File that is Empty in SSIS Package - Handling Empty Files in SSIS Package
In this video tutorial, I am going to show you that how you can check if the source file is empty and you can move to some folder and load the files which have the data.
We will use script task and constraints to handle this logic. At the end of Package we move the files to achieve folder after loading them.
C# code used in Scrip Task
Dts.Variables["IsEmpty"].Value = 0;
if (new FileInfo(Dts.Variables["FilePath"].Value.ToString()).Length == 0)
{
Dts.Variables["IsEmpty"].Value = 1;
}
Constraints
@[User::IsEmpty]==1 -- file is empty
@[User::IsEmpty]==0 file is not empty