Flat file connection having column names in Header

  • Hi,

    I'm using a Flat file destination. I 'Check' the column names in the first data row in the connection and 'un check' overwrite the data in file.

    So that i should have column names in first row and every time the data should be updated to the existing flatfile and not over written.

    But the problem is every time it writes the column headers when it writes the data to the file. I get the headers in between data rows.

    ID NAME

    1, ZED

    ID NAME

    2, MAX

    I tried from package configurations to write the property 'column names in the first row' to be true. but it is not taking the original column names instead it takes like column1, column 2 etc.

    how to resolve this?

    Thanks,

    Ami

  • Is it writing the column names between every row or between every run of the process? If the data is not to be overwritten and you have specified putting the column names in the first data row, then everytime you run the process, the column names will be the first row appended to the file.

  • Yeah, uncheck the Column Headers and see how it goes.

  • Yes, the unchecking of columns in first row will not help if you are putting data into a file for the first time. Search google for "ssis merge flat files". I found one solution here - http://social.msdn.microsoft.com/Forums/sqlserver/en-us/771a7e11-cf32-48af-bd64-dfc058819e19/how-to-merge-csv-files-using-ssis?forum=sqlintegrationservices

    try it and see how it goes.

    A foreach loop to iterate over each of your CSV files.

    Inside the foreach loop, I would add a data flow. Then in the data flow create a single Flat File Source and a single Flat File destination. The destination should be setup to append, not overwrite. Then, you can configure the Flat File Source via expressions to take its current values from the Foreach Loop so that each time a new file is encounted, the data flow executes, appending data to a single file.

    There are plenty of examples of how to do this on this forum and on the 'Net. So, for the time being, I'll leave that exercise for you to perform. Search for "foreach loop expressions data flow" and see what you come up with.

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

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