coventri
asked on
How to add header and trailer to text file using ssis
I want to add header and trailer to text file using ssis.
The header and trailer must be in different rows.
I attched ssis package which I created.But i did not get correct result.
can any one check and give right suggestions
Thanks,
coventri
Package.txt
The header and trailer must be in different rows.
I attched ssis package which I created.But i did not get correct result.
can any one check and give right suggestions
Thanks,
coventri
Package.txt
ASKER
Hi,
I am using oledb source in ssis(sql command as data acess mode) to prepare data .How can I pass
col 2 as variable in header row
Thanks
coventri
I am using oledb source in ssis(sql command as data acess mode) to prepare data .How can I pass
col 2 as variable in header row
Thanks
coventri
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could export a seperate header.txt and trailer.txt file, then use a DOS COPY command to append them all together.
COPY Header.TXT + Data.TXT + Trailer.TXT FinalFile.TXT
COPY Header.TXT + Data.TXT + Trailer.TXT FinalFile.TXT
For example:
select 1 as rownum, col1 + col2 + cast(sum(col3) as varchar(30)) as fileline from ... (header row)
union all
select 2 as rownum, col3 + col5 + col6 + col9 + col19 + col33 as fileline from ... (detail rows)
union all
select 3 as rownum, .... as fileline from ... (footer / trailer)