I have a record with five fieldss like
Column Names :A B C D E
Column Values :1 2 3 4 5
i want to convert it to 3 records with four fields as following:
Column Names : A B COL_NAME COL_VAL
Column Values : 1 2 C 3
Column Values : 1 2 D 4
Column Values : 1 2 E 5
I have 85(2+83) fields that needs to be converted to 83 records with 4 (2+2) fields.
I donot know how to get the third field using PIVOT, please share your ideas.
Thank You
Splitting a single record into multiple records
Moderators: chulett, rschirm, roy
-
- Charter Member
- Posts: 64
- Joined: Sat Sep 17, 2005 10:42 am
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Doesn't matter what the actual values are. I'm sure A,B,C,D was just an example. You can hard code any string value such as Unfortunately in this case it will require 83 comma-delimited fields. On the up side, it will only need to be constructed once. Copy/paste it to your Description field and to your target-from-source mapping documentation and you'll never need to type it again, unless the column names change in future.
Code: Select all
"ItemNo,ItemClass,PkgType,PkgQty"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.