How To Add Multiple File Extensions To The Files: Input Field In The Foreach Loop Container Ssis
Solution 1:
I don't think you can specify two file type extensions in a For each Loop container , you should use *.* and you can filter for a specific extensions by using the following steps:
- add a Variable of type boolean (ex:
User::Flag) - add a
script taskinside the container and markFilenamevariable as Readonly ,Flagvariable asReadWrite
Inside the script write the following script
PublicSub Main() Dim strFile AsString = Dts.Variables.Item("Filename").Value.ToString SelectCase IO.Path.GetExtension(strFile).ToLower Case".csv", ".zip" Dts.Variables.Item("Flag").Value = TrueCaseElse Dts.Variables.Item("Flag").Value = FalseEndSelect Dts.TaskResult = ScriptResults.Success EndSubAdd an expression to the
Script taskoutput connector like shown below
Or you can achieve it by using a Third-party components like Foreach File Enumerator with regex
Solution 2:
Step 1) Create a variable which store the file name with the extension.Step 2) Under the foreach loop container Map the variable which we created in step 1. Step 3) create a execute sql task inside the foreach loop container, add connection and under sql statement enter the code insert into tablename(filename) values (?). Step 4) Under parameter mapping select the variable which we created under variable name, changed the data type to nvarchar and changed parameter to 0. Step 5) With the help of string function then you can create an expression with the help of string function like right


Post a Comment for "How To Add Multiple File Extensions To The Files: Input Field In The Foreach Loop Container Ssis"