Retrieving Column Name along with value

One Star

Retrieving Column Name along with value

Hi Shong,
Hope you are doing good!
I have this requirement ...
Table1
------------------------------------
|ID|column1|column2|column3|
------------------------------------
|10|1.23 | 234.32 |987.45 |
------------------------------------
This Table1 will be TRANSFORMED into
Table2
----------------------------------
|ID|KEY |VALUE |
----------------------------------
|1 |column1 | 1.23 |
----------------------------------
|2 |column2 |234.32 |
----------------------------------
|3 |column3 |987.45 |
----------------------------------

So in Simple words its a horizontal to vertical transformation where a single row (with N columns except PRIMARYKEY column ) will be transformed into N rows as key/value pairs where key=columnName and value is the Actualvalue
Can anyone please suggest me any solution on how to get "COLUMNNAME " instead of value in it!
Appreciate any thoughts/solution on this.
Thanks
Madhu Prasad Paridi
Community Manager

Re: Retrieving Column Name along with value

Hello
See a related 6441.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Retrieving Column Name along with value

Thanks Shong!!. I Appreciate your help.
Regards
Madhu Prasad Paridi
Employee

Re: Retrieving Column Name along with value

I also have the same requirement. I have looked at the linked topic and can get the column names displayed to the console, but that does not pivot the row to create multiple rows.
Is there a mechanism for generatign the output detailed:
Input Flow:
------------------------------------
|ID|column1|column2|column3|
------------------------------------
|10|1.23 | 234.32 |987.45 |
------------------------------------
Output Flow:
----------------------------------
|ID|KEY |VALUE |
----------------------------------
|1 |column1 | 1.23 |
----------------------------------
|2 |column2 |234.32 |
----------------------------------
|3 |column3 |987.45 |
----------------------------------
Thanks in advance
Seven Stars

Re: Retrieving Column Name along with value

Try tUnpivotRow from the Exchange or tSplitRow. There are many posts about these.