Page 1 of 1

Converting Rows to Columns

Posted: Fri Jun 26, 2009 12:27 am
by balu536
Hi all,
I have a requirement to convert the rows present in a source table to Columns.
For ex:
Id Name Value
1 Jhon 3
1 Sam 5
2 Serena 1
2 William 7
2 Jose 9
3 Paul 5
3 Fedy 4

and the required output is

**1st record**
Id Jhon Sam
1 3 5

**2nd record**
Id Serena William Jose
2 1 7 9

**3rd record**
Id Paul Feddy
3 5 4

The data in the target is very huge(Around 80 million).
I cant implement this logic in SQL query and extract it from Oracle stage in datsatge as for each Id the Columns are differing and also the data is huge.

Please explain me the procedure how to implement the same in datastage without degrading the perfomance.

Posted: Fri Jun 26, 2009 12:34 am
by ray.wurlod
It's a vertical pivot. Since you have no other way of doing it, there's no danger of degrading performance because you don't have any "performance".

Search for "vertical pivot".

Posted: Fri Jun 26, 2009 12:46 am
by balu536
Will you please explain how to acheive the Vertical Pivot logic using the Datastage.

Posted: Fri Jun 26, 2009 12:57 am
by ArndW
balu356 - Ray suggested you use the Search to find the many threads that deal with this question of vertical pivoting. If you search those threads and don't find the information you are seeking then please ask on this thread.

Posted: Fri Jun 26, 2009 2:21 am
by balu536
I've searched using the Vertical Pivot literal but there were many threads,where everyone is replying to search for the topic as it was already discussed many times,but i couldn't really find one which solves my logic.I found a solution where the number of records per key are fixed but that's not the case with me.Please provide me the link to the Original thread where the Vertical Pivot is done for Dynamic rows(i.e no specific count of rows for a particular Key)

Regards,
Balakrishna

Posted: Fri Jun 26, 2009 2:21 am
by balu536
I've searched using the Vertical Pivot literal but there were many threads,where everyone is replying to search for the topic as it was already discussed many times,but i couldn't really find one which solves my logic.I found a solution where the number of records per key are fixed but that's not the case with me.Please provide me the link to the Original thread where the Vertical Pivot is done for Dynamic rows(i.e no specific count of rows for a particular Key)

Regards,
Balakrishna

Posted: Mon Jun 29, 2009 9:00 pm
by laknar