Search code examples
sql-serverssisflatfiledestination

SSIS Flat File Destination columns with the same name?


I need to create an output CSV file whose some of the column names/descriptions are the same, ie:

ColA   %Total   ColB  %Total

In SSIS Flat File destination, Flat File Connection Manager Editor does NOT allow columns with the same name. There is no Column Description.

Is it possible for a Flat File CSV file to have the same column names?

Thank you


Solution

  • Yes it is possible to have the same name for columns in a CSV. Because the CSV "standard" doesn't care about the content of the header row RFC 4180

    However, SSIS will raise a bit of a stink as it needs to have a way to uniquely identify the columns. In your Flat File Connection Manager, you'll specify that you have a CSV file with NO HEADER. You'll still need to define column names so name your repeating column names something intuitive, like %Total_ColA and %Total_ColB. Map your columns and run the output. Everything should be good except for the missing header row.

    In the Flat File Destination, we're going to use the same approach as Option 2 Create summary rows with detail rows in SSIS The component offers a Header property either in the Dialogue box

    enter image description here

    or as the Header property

    enter image description here