Using columns as rows

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Using columns as rows

Post by admin »

Using Datastage, how would you go about looping through a set of columns as if they were rows?

For instance, given a text file, with the following fields: OrderNumber Item1Code Item1Qty Item2Code Item2Qty Item3Code Item3Qty etc...

I want to insert a new row into an orders table for each new OrderNumber (for each row in the text file) and insert a new row into an items table for each ItemCode that is not null.

Any help is appreciated,

Anthony
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

There are at least four different ways to do this kind of normalization using DataStage. Probably the easiest is to perform a horizontal pivot on your data using the Pivot stage.
Locked