converting a single row to multiple rows

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
nishantrk
Premium Member
Premium Member
Posts: 23
Joined: Fri May 27, 2011 11:43 am

converting a single row to multiple rows

Post by nishantrk »

I have the data coming in as below
col1 col2 col3 col4
Jay x x
kay x x


output :Insert into DB2 table using ODBC

jay col2
jay col4
kay col2
kay col3

Since we have only 8.1 version..I was thinking for having a transformer stage with 3 outputs each having a constrain on cols2,col3 col4 respectively.

Since am brand new to data stage , curious to know if this could be done by other methods and their merits..
vinothkumar
Participant
Posts: 342
Joined: Tue Nov 04, 2008 10:38 am
Location: Chennai, India

Post by vinothkumar »

Search for "pivoting" in this forum which helps you more on this.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

A "horizontal pivot" specifically... columns to rows.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Bicchu
Participant
Posts: 26
Joined: Sun Oct 03, 2010 10:49 pm
Location: India

Post by Bicchu »

A pivot stage can able to solve the problem. In the derivation section of the output tab in the pivot stage, give the column names that you want to convert from horizantal to vertical form.
Thanks,
Pratik.
satisht
Participant
Posts: 15
Joined: Tue Nov 07, 2006 4:41 pm

Post by satisht »

Yeah Pivot can help
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a Pivot stage (or a PXPivot stage).
:wink:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply