Read Edi File in Ssis Script Task
Case
I recently did a post on how to get filedates in SSIS, simply I got questions nigh how to get other file backdrop similar size, owner and a bank check whether the file is locked past an other procedure.
Solution
You could utilize the open source File Properties Job, but you can also do information technology yourself with a Script Task. Let'due south elaborate that Script Job solution.
1) Create variables
I created a whole bunch of variables, ane for each file property. Find the various datatypes. Fill the variable FilePath with a value.
|
| Right click in your Control Flow to actuate Variable window |
2) Script Task
Add a Script Job to your Command Flow. I didn't add together the variables to the readonly and readwrite lists of the Script Chore, but locked them in the script. See this article for the difference between those methods.
|
| Script Task |
2a) Optional
This stride is optional. It depends on whether you choose script 3a or 3b. This step is required for script 3a.
Select all the new variables as ReadWriteVariables. Simply the FilePath can be a ReadOnlyVariable.
|
| ReadOnly- and ReadWriteVariables |
3a) The script (if yous used 2a)
Re-create the following code (usings and method) to your Script Task and remove the backdrop y'all don't demand.
// C# code // Fill up SSIS variables with file properties using System; using System.Data; using Organisation.IO; // Added to go file backdrop using System.Security.Primary; // Added to get file owner using System.Security.AccessControl; // Added to become file owner using Microsoft.SqlServer.Dts.Runtime; using Arrangement.Windows.Forms; namespace ST_9ef66c631df646e08e4184e34887da16.csproj { [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")] public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase { #region VSTA generated code enum ScriptResults { Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success, Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure };
0 Response to "Read Edi File in Ssis Script Task"
Post a Comment