I have good experience in SSIS, but nil as far as Script Task and Script Component are concerned.
I have a situation in which I am loading many .csv files into a SQL Server destination table. I am using a For Each Loop Container.
I am loading these files, capturing the File Name, Row Count, and other information needed into various SSIS user variables.
I load some of these variables into an Audit Tracker table using an Execute SQL Task in the Control Flow, after the Data Flow Task (all inside a For Each Loop Container)
Upto this point, everything is fine.
Now our client wants to capture the FileCreationDate (i.e.Date Modified) andFileSize of each of these .csv files. I need to capture them in separate user variables.
Obviously I need help, because this cannot be done without some scripting.
In the Control Flow, inside the ForEachLoop Container, I have added a ScriptTask immediately after the Data Flow Task.
I have the following three user variables in the package:
1) User::Filename (string variable for each.csv files;this is fine, no issue)
2) User::FileCreatedDateTime (variable to capture the creation date of each .csv file; please let me know whether DateTime datatype will be okay)
3) User::FileSize (variable to capture the size of each .csv file; let me know whether string datatype will be okay)
Now, can anyone let me know the following settings inside the Script Task Editor ?
Script Tab :
Language as Microsoft Visual C# 2017 (disabled)
Entry Point: Main (Is this correct?)
ReadOnlyVariables: (What should I set ?)
ReadWriteVariables: (What should I set ?)
Expressions Tab:
What expressions should I set ? i.e. Property and Expression.
Edit Script:
What code should I type ? I referred to these two websites, but not able to get the right code
http://www.techbrothersit.com/2011/02/ssis-load-files-information-to-sql.html
https://stackoverflow.com/questions/31556943/ssis-read-file-modification-date
Can someone please give me the clear code and clarify the other doubts ?