Task to do :
0.Check the presence of the flat file,if file does exist, go on to 2, or go the end by wring log to physical log file
1. Read a flat file and bulk insert into to temp table for further processing.
2.rename the file and copy it to archival folder.
Knowledge (SSIS 2012, C# codes)
1.File existence checking by using "script task" . Added variables....Edit script to check file presence
C# :
String file = (String)Dts.Variables["strFileLocation"].Value ;
Dts.Variables["bolFileExists"].Value = System.IO.File.Exists(file);
2.Control Flow
3.Use "File System Task" to rename file and copy file
4.Enable logging by right-clicking the anywhere in "Control Flow" editor area
5.Edit script task to write specific logging to log file , codes in the main method :
int rowsProcessed = 100;
byte[] emptyBytes = newbyte[0];
try
{
Dts.Log("File doesn't exists!!! " + rowsProcessed.ToString(), 0, emptyBytes);
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception ex)
{
//An error occurred.
Dts.Events.FireError(0, "Script Task Example", ex.Message + "\r" + ex.StackTrace, String.Empty, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
Reference :
scripts taks for logging - http://cimi-digssis.blogspot.sg/2010/05/logging-in-script-task-dtslog.html
rename file : http://www.youtube.com/watch?v=pQHCkPETmoo
File existence : http://www.bidn.com/blogs/DevinKnight/ssis/76/does-file-exist-check-in-ssis