Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Flat file connection having column names in Header Expand / Collapse
Author
Message
Posted Wednesday, November 20, 2013 10:24 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, July 18, 2014 9:11 AM
Points: 317, Visits: 929
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
Post #1516318
Posted Thursday, November 21, 2013 8:59 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 9:00 AM
Points: 488, Visits: 1,856
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.
Post #1516470
Posted Friday, November 22, 2013 12:05 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:05 PM
Points: 300, Visits: 810
Yeah, uncheck the Column Headers and see how it goes.
Post #1516896
Posted Wednesday, November 27, 2013 12:20 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, May 15, 2014 8:51 PM
Points: 183, Visits: 480
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.
Post #1518176
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse