Solved

SQL 2005 SSIS Include hearer and footer rows in Data Extract

Posted on 2009-07-14
5
423 Views
Last Modified: 2013-11-10
I've been tasked with creating a merchandiser product extract for submission to Linkshare. I've extracted all the product information into a new table in SQL and using SSIS i've exported the table to a CSV file. However that's where I come unstuck.

The requirements also state that I need to do the following:
1. Add a header row to the CSV file in the format: HDR | Merchant id | Company Name | Time Stamp
2. Add a footer row below the product information in the format: TRL | product row count
3.Finally the resultant file name needs to include the date in the format filename_20091407 ie. yyyyddmm

Anyone?

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
5 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24851900
1.  If the header delimiter is the same as detail rows, then all you need to do is include the column names in the first row.
2. This can sometimes be accomplished by using a UNION statement with the same number/type of columns as the rest of the data.  Alternatively you will have to open the file and write the results at the end.
3. You can change this programatically within the SSIS package.
0
 

Author Comment

by:Christie_M
ID: 24852061
Both the header and the footer are different formats from the product data itself. So there would be no way to join tables or populate the first row. Any other ideas.

3. How do I porgram this in the SSIS package?
0
 
LVL 22

Accepted Solution

by:
PedroCGD earned 500 total points
ID: 24867904
I created a example package with the solution at:
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_24571933.html

Helped?
Regards,
Pedro
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Display SQL maintenance plan SQL Code 3 47
how to solve "recursive" database tables 2 55
mssql 7 32
Section based report in SSRS 14 30
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

732 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