Output report generation in SSIS
In my SSIS package I am generating 5 different text files with varying header and footer files attached to each one of them. I would like to know how I can combine all 5 different text files into one text file in SSIS. Can someone please help me with it. Thanks,
July 11th, 2011 12:13pm

What do you mean by COMBINE? do you want to combine them with columns? or with rows? if you want to add rows one after each other, you can use different source for each flat file, and then use UNION ALL Transform to combine them. if you want to add columns besides together , you can use different sources and use Merge Join Transform for both of them and then merge join result of them to another file and do same to the end file, just note that when you set inputs for merge join transform you should sort them .http://www.rad.pasfu.com My Submitted sessions at sqlbits.com
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 12:16pm

You can do Execute Process task that encompasses the following DOS batch command: MyFile1 > MyFile2 > MyFile3 etc. the > redirects the output, so ultimately the last file gets them all Arthur My Blog
July 11th, 2011 12:18pm

Can you please provide me few more details about it
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 12:20pm

I need to merge all text files into a single text file
July 11th, 2011 12:21pm

you can also use this command in execute process task: cmd.exe copy file.txt + file2.txt + file3.txt destination.txtor you can use script task and write .net code to combine them all, with for example this c# code:string contents1 = File.ReadAllText(filename1);string contents2 = File.ReadAllText(filename2);string contents3 = File.ReadAllText(filename3);File.WriteAllText(outputFileName, contents1 + contents2 + contents3);http://www.rad.pasfu.com My Submitted sessions at sqlbits.com
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 12:27pm

I am just curious is there any other way to implement it or only in the above mentioned way
July 11th, 2011 12:35pm

there is also another way, using ssis data flow, you can set flat file source without column delimiter, just with row delimiter and fetch from source into destination, you should put the data flow task inside a foreach loop which loops through source folder which contain all files. also note that you should set the flat file column as wide as your data is in advanced tab of flat file connection manager editor, as this way needs lots of tasks to do, it is better to use methods with Execute process task or Script task as previously mentionedhttp://www.rad.pasfu.com My Submitted sessions at sqlbits.com
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 12:40pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics