Question

httsqv on Thu, 14 Jul 2016 20:01:46


Hi,

I have a flat file source that load file text but the column order is an issue.

For example :

File1

------

FirstName     LastName      Age      StartDate

John              Coul              25         8/12/2014

File2

-----

FirstName      Age      StartDate       LastName

John              25        8/12/2014      Coul

If I set flat file source to the file1 model

then when loading files (file1 and file2) 

The final load into database will be 

FirstName     LastName      Age      StartDate

John              Coul              25         8/12/2014

John              25        8/12/2014      Coul

Any solution for that ?

I need the final load to be 

FirstName     LastName      Age      StartDate

John              Coul              25         8/12/2014

John              Coul              25         8/12/2014

Thanks


Sponsored



Replies

DIEGOCTN on Thu, 14 Jul 2016 20:38:43


You have the table AAA in SQL with firstname, lastname, age, startdate. When you set the two data flow (just set two instead of one) you can easily give the relation between the columns (using mappings). It doesn't matter the order in the excel file.

Please mark as answer if this post helped you

COZYROC on Fri, 15 Jul 2016 09:57:59


You can easily handle this situation using the commercial COZYROC Data Flow Task Plus. This is an extension of the standard Data Flow Task which supports dynamic columns metadata at runtime. No programming skills are required to use.

Seif Wang on Fri, 15 Jul 2016 10:27:22


Hi Httsqv,

As far as I know, you could re-sort the flat file column by using PowerShell command before loading data from flat file into database, here is an example in this link, please reference.

Regards,

Seif

Aamir Shahzad Warraich on Fri, 15 Jul 2016 18:55:12


Hi,

here you go with script task How to Load Text /CSV files with same or less columns than destination table by using Script Task in SSIS Package