Split a column into 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
datastagenewbie
Participant
Posts: 64
Joined: Tue Sep 23, 2008 9:54 am

Split a column into multiple rows

Post by datastagenewbie »

Hi!
I have two columns in a table
ColA ColB
43459 30495
43463 28000300010800110001

I need the output to be
ColA ColB
43459 30495
43463 28000
43463 30001
43463 08001
43463 10001

In other words i have to split colA into multiple rows of size 5
Any help is appreciated
Thanks in advance.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

In transformer have 5 outputs and derivations for each output is

Code: Select all

ColA,ColB[1,5]
ColA,ColB[6,5]
ColA,ColB[11,5]
ColA,ColB[16,5]
ColA,ColB[21,5]
You are the creator of your destiny - Swami Vivekananda
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... and bring them back together with a Funnel stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
datastagenewbie
Participant
Posts: 64
Joined: Tue Sep 23, 2008 9:54 am

Post by datastagenewbie »

Yes, we could do that if ColB wasn't of lenght 800
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not mention that originally? So... up to 160 records per? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
datastagenewbie
Participant
Posts: 64
Joined: Tue Sep 23, 2008 9:54 am

Post by datastagenewbie »

Sorry, I should have mentioned that. My bad!
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

In transformer define 160 columns and assign ColB[1,5],ColB[6,5],ColB[11,5] ,ColB[16,5] ,ColB[21,5]... to it

Then use Pivot stage
You are the creator of your destiny - Swami Vivekananda
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... and then constrain out the nulls after that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Or Optionally the Column Import can be used.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply