February 13, 2013 at 3:47 am
Hi all,
i created one ssis package which has for each loop container to loop through all text files in folder.
In data flow task i'm just reading and inserting into destination table.
the problem is some files have extra columns.so i need validate those files before loading and need to remove those extra columns.
any suggestions how do that?
flat file is delimited.
February 13, 2013 at 5:28 am
You could use a Script Task to recognize the file format. In the Script Task, once you know you have a file you want to pre-process here are a couple options:
1. In the Script Task read the file line-by-line and write a new file with only the columns you need.
or
2. In the Script Task set a Variable you can then use in a Precedence Constraint to run a Data Flow task containing a Flat File Source and a Flat File Destination. The Data Flow Task will be used to generate a new file with only the columns you need.
For option 2 your control flow might look like this:
The Precedence Constraints coming from the Script Task would both check the variable set inside the Script Task to know whether to pre-process the file or whether it could be loaded as-is.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply