Solved

SQL 2005 SSIS Add an unrelated header line to a text file

Posted on 2009-07-15
4
351 Views
Last Modified: 2013-11-10
I need to add an unreleated header line to the top of a text file I'm already extraciting using a SSIS package.

The extracted file needs to look like this:

HDR | MERCHANT REF | MERCHANT NAME | TIME STAMP
1321 | Cushions | CC1234/01| In Stock | £120.00 | Percentage Discount | 50 | etc.
1321 | Cushions | CC1234/01| In Stock | £120.00 | Percentage Discount | 50 | etc.
1321 | Cushions | CC1234/01| In Stock | £120.00 | Percentage Discount | 50 | etc.
1321 | Cushions | CC1234/01| In Stock | £120.00 | Percentage Discount | 50 | etc.
1321 | Cushions | CC1234/01| In Stock | £120.00 | Percentage Discount | 50 | etc.

The header row has a differnet number of columns and different data type from the rest of the extract. So I can't just populate the first row of the source table. So:

1. How do I ammend the SSIS package to write a custom header row to the text file before the rest of the data is written?
2. What expression will give me a time stamp in the final column of the header row?
0
Comment
Question by:Christie_M
  • 3
4 Comments
 
LVL 22

Expert Comment

by:PedroCGD
ID: 24858782
You can add the header after creating the file, correct?
You can use a script task to add an extra row in the header!
Regards,
Pedro
0
 

Author Comment

by:Christie_M
ID: 24858832
Thanks Pedro, there is nothing to stop me adding the header retrospectively. I just don't know how to do that. Do you have an example script that I could use?
0
 
LVL 22

Accepted Solution

by:
PedroCGD earned 500 total points
ID: 24861404
Take a look to the package I made here and try to customize!
Regards,
Pedro
0
 
LVL 22

Assisted Solution

by:PedroCGD
PedroCGD earned 500 total points
ID: 24862127
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now