Solved

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

Posted on 2009-07-15
4
356 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

717 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