Advertisement

11.04.2007 at 05:27AM PST, ID: 22937525
[x]
Attachment Details

DTS Text File Destination - export different sorts of data into one file?

Asked by c11esh in MS SQL DTS, MS SQL Server

Tags: , , , ,

Hi,
I need to create a csv file from a DTS package containing header and detail row's which contain a different number of columns. The header must be followed by the order lines for that order. The detail lines hold no order number to match back to the header. Example below

The data is coming from 2 tables an order header and order details. If I use 2 separate Transform Data Tasks for the header and the details, I cannot find a way to merge the files together in a way where the details lines follow the header.

If I use 1 Transform Data Task I have additional blank columns added onto the end of the details lines to for the additional columns that are required in the header only.

I have tried Activex (sample below)on the header specific columns, example below, but cannot find a DTSTransformStat_ that will allow the row to be inserted and ignore the columns.

Can anyone suggested the best way of achieving this?

Function Main()
      DTSDestination("F4") = DTSSource("F4")
   
if isnull(DTSSource("F4").Value) then
 main = DTSTransformStat_SkipInsert
else
 Main = DTSTransformStat_Ok
end if
End Function

File Sample

"H","ORDER","NODUPE","XXX01","","","","","311470","0091372","240570","","RWIL100","","","","","","","","","",""
"L","BLFLWPET2","","336","","","","","0190153","","   1",""
"L","WLINSQQCSDBLIL","","81","","","","","0196173","","   2",""
"H","ORDER","NODUPE","XXX01","","","","","311471","0084567","240570","","RWIL200","","","","","","","","","",""
"L","BLFLWPET2","","445","","","","","0190153","","   1",""
"L","WLINSQQCSDBLIL","","82","","","","","0196173","","   2",""



Start Free Trial
[+][-]11.04.2007 at 02:26PM PST, ID: 20212602

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.04.2007 at 03:13PM PST, ID: 20212818

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL DTS, MS SQL Server
Tags: dts, file, text, export, header
Sign Up Now!
Solution Provided By: nmcdermaid
Participating Experts: 3
Solution Grade: A
 
 
[+][-]11.04.2007 at 03:27PM PST, ID: 20212896

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.04.2007 at 08:41PM PST, ID: 20213868

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628