Solved

SQL 2005 SSIS Include hearer and footer rows in Data Extract

Posted on 2009-07-14
5
421 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

756 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