single row spliting into Multiple rows in one column

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
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

single row spliting into Multiple rows in one column

Post by vinsashi »

Hi ray,
my input like this

Code: Select all

ename                                              managerid
raj,sasi,chum                                     1000
kumar,vin                                          1001
kotak,vatson,jem,pinky                       1002
and i want output like this

Code: Select all

ename         managerid
raj                     1000
sasi                    1000
chum                  1000
kumar                 1001
vin                      1001
kotak                  1002 
vatson                 1002
jem                     1002
pinky                   1002
Thanks in Adavance
vin...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

"Hi Ray"? Seriously? :?

That's a horizontal pivot aka columns to rows and oddly enough there's a stage for that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Post by vinsashi »

Hi,
Please help me for this...
Thanks
vin...
datskosaraju
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 25, 2008 11:10 pm
Location: Des Moines,IA

Post by datskosaraju »

vinsashi wrote:Hi,
Please help me for this...
Thanks
vin...

As Craig mentioned, There is stage for doing that, the Pivot stage. Was that not clear?
"It's easier to go down a hill than up it but the view is much better at the top"
-Bennet,Arnold
datskosaraju
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 25, 2008 11:10 pm
Location: Des Moines,IA

Post by datskosaraju »

vinsashi wrote:Hi,
Please help me for this...
Thanks
vin...

As Craig mentioned, There is stage for doing that, the Pivot stage. Was that not clear?
"It's easier to go down a hill than up it but the view is much better at the top"
-Bennet,Arnold
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Post by vinsashi »

Hi,
we cant do by using pivot stage for that scenario. i have tried with pivot stage also.in the pivot stage we can merge data from 2more columns to single column.but here singl column row data we are spliting into under same column multiple rows. if any other solution...please tel me

Thanks
vin..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Use the Pivot stage. "Merging data from two or more columns to a single column" is exactly the same as "splitting into under same column multiple rows".
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You will first need to split up those "comma delimited columns" into individual columns first, but there are stages for that as well. You'll probably also need to constrain out any null values post pivot.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Post by vinsashi »

hi,
I have tried with that one.but in my source under one column data will generated dynamically its not fixed

Code: Select all

ename                    mid
aa,bb,cc                1001
cc,dd                     1002
ee,ff,gg,hh,ii          1003
here we not constant under ename we may get more than 5values also with comma.how can we will divide columns with comma deleimeter.
Thanks
...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A Column Import or Transformer stage will do it for you. But you need to have sufficient target columns available to receive the values, and these probably need to be nullable.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In other words, provide for the maximum number in your design, remove any null/empty ones post pivot. The Column Import stage or a Transformer leveraging the Field() function will prep the data for the Pivot.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Post by vinsashi »

Hi,
Thanks a lot.

thanks
vin..
Post Reply