SSIS - Dynamic Column mapping

  • Hi,

    I am new to SSIS and i got 1 assignment.

    Requirement:

    In my destination table i am having some 30 columns and the CSV files what i get may have 10 columns or 20. How do i map columns between source and destination dynamically?

    Thanks in advance.

    Regards,

    Vijay

  • You don't. There really isn't way I know of to do what you are trying to do. You could look into BIML, but even then you need metadata of your source and destination and a way to map field A in the file to column 1 of the table.

  • To do that you're going to have to write your own file import script (Data flow Script Component as Source). It will have to parse the incoming files into a defined set of columns that can then be mapped to your 30 output columns. That script could do so based on column names (if they are named) or some sort of mapping table.

    Alternatively you could code your own SSIS component to do the same thing.

    Another option, should you have a fixed set of know file configurations would be to have a script in your control flow which looked at the input file to determine which type it was, then branched to the right data flow to import that particular type, which output a standardized raw file. Then a data flow could be put lower in your control flow to work from that raw file.

    There's almost always a way to do something, but you sometimes have to get your hands dirty and write code.

    It would be nice if there was a dynamic source module though.

  • Hi ,

    Now we decided to have mapping metadata table with source columns and destination columns details. Now how to archive this?

    Thanks in Advance

    Regards,

    Vijay

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

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