Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Extract data with mutliple "headers" in 1 file

Author  Topic 

shillr
Starting Member

2 Posts

Posted - 2006-10-05 : 05:40:02
My query relates to that of Lightbug3 and the solution from X002548.

My query is how do I have multiple headers within the export file?

I am extracting order information using DTS whereby there is a header containing the purchase order number and the detail being the product ordered for that PONumber.

I need to start a new header for each new purchase order number.

I'm looking to create something similar to

PONumber 1
Product, qty
Product qty
PONumber 2
Product, qty
Product qty

Would be grateful for any advice.

Thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2006-10-05 : 09:08:32
Format the resultset in a stored proc in a temp table with a sequence value.
Produce the resultset ordering by the sequence value.
Extract using that sp and you can format it how you want.
I often do this using a single column table so that I can hold an image of the extract in a table.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-10-05 : 09:36:47
Just do the same thing with multiple unions

http://weblogs.sqlteam.com/brettk/archive/2006/06/29/10426.aspx



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -