Multipleflat files with different number of columns using SSIS

  • Hi,

    I have come across situation where I need to load sql table from multiple flat files, I have created SSIS package with Data flow task, For Eachloop Container and File System Task.But now I got two flat files which has one extra column and one column missing in another flat file, how to handle this scenario. Could some help me.

    Thank you

  • Use the data manipulation tools in SSIS to remove columns you do not need, or to add extra columns with default values; then combine the results.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Sangeeth878787 (1/13/2016)


    Hi,

    I have come across situation where I need to load sql table from multiple flat files, I have created SSIS package with Data flow task, For Eachloop Container and File System Task.But now I got two flat files which has one extra column and one column missing in another flat file, how to handle this scenario. Could some help me.

    Thank you

    As Hugo mentioned, one way is to pre-process the files so they all conform to the same format before you try to load them.

    Since a Flat File Connection Manager wants to process a specific file format another option is to setup multiple Data Flow Tasks, one that can process each type of file. In your Foreach Loop Container can you know the format from the file name? If not, then you can determine the format using a Script Task. Once you know the format Precedence Constraints can ensure only the relevant Data Flow Task for the file format processes the incoming file.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply