December 17, 2015 at 10:56 am
I have a scenario where i need to append results of 2 queries in one output file which have different columns
for example first query willl have header record and have 5 columns
second query will have 30 columns
records of second query should come after first query..
i created a flat file connection manager and added all first and second columns in it..I ran sequentially 2 queries and made sure that it populated records in file...I got records but it is not in format i expected
Below is example
Header|xxxxx| |20151217|20151217|20151217110504|||||||||||||||||||||||||||||||
|||||||abc|012103001400| |00000001 0| | | || | || ||13| |1|20110226|20110226|||17530101|1753-01-01T00:00:00||||||||
|||||||abc|012103001400| |00000001 1| | | || | || ||13| |1|20110226|20110226|||17530101|1753-01-01T00:00:00||||||||
due to both have same connection manager it displaying empty for first few columns in second row..
My question in second row .. i should not get first ' ||||||'..actually record starts from abc..How to do it? any suggestions
December 17, 2015 at 11:09 am
Easiest way I know is to create two separate files and then use an Execute Process task to append one to the other
copy file1.txt+file2.txt all.txt
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
December 17, 2015 at 11:59 am
i always seem to import things like this to a staging table, then export the results to the file.
December 17, 2015 at 12:07 pm
Manic Star (12/17/2015)
i always seem to import things like this to a staging table, then export the results to the file.
The OP does not mention any requirement for an import.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
December 17, 2015 at 1:09 pm
Thanks guys...finally i got it..i just used 2 different connection managers and same file name..it worked out
December 17, 2015 at 1:33 pm
ssisguy (12/17/2015)
Thanks guys...finally i got it..i just used 2 different connection managers and same file name..it worked out
We'll done. I'd forgotten about that trick.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
February 8, 2016 at 8:10 am
This can be done
by using Execute Process task all you need to do is
Put CMD.EXE on the executable
Put
/C type headerfile.txt datafile.txt footer.txt > Your final file.txt ( this appends the header file records..data file records and footer file records to the final file
put
your working directory where all these files will be at ....
where your header footer and data file is at ,
and finally
the results will be
Header file data
data file data
and then the
footer data ...
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply