how can we split into multiple records
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 97
- Joined: Tue Feb 21, 2006 6:45 am
how can we split into multiple records
Hi all,
need a bit of help with splitting into multiple records.
i have 7 columns as shown below (ps there are more than 7 columns in the table)
id,sales_typ1,sales_amt1,sales_typ2,sales_amt2, sales_typ3,sales_amt3.
I want to split into three records as below
id,sales_typ1,sales_amt1,
id, sales_typ2,sales_amt2,
id, sales_typ3,sales_amt3.
How can I do this in datastage?
Regards
need a bit of help with splitting into multiple records.
i have 7 columns as shown below (ps there are more than 7 columns in the table)
id,sales_typ1,sales_amt1,sales_typ2,sales_amt2, sales_typ3,sales_amt3.
I want to split into three records as below
id,sales_typ1,sales_amt1,
id, sales_typ2,sales_amt2,
id, sales_typ3,sales_amt3.
How can I do this in datastage?
Regards
-
- Participant
- Posts: 97
- Joined: Tue Feb 21, 2006 6:45 am
i have never used the pivot stage, so dont know weather it can be achieved via pivot stage.
A simpler solution is as i suggested, provied the target meta data remains identical,
pass your file through the transformer, have three links coming out of it
pass id to all three, and the second column to the first link, the third column to the second link and the last column to the third link. Collect it via link collector. Your final target, collected file will have the result you desire.
A simpler solution is as i suggested, provied the target meta data remains identical,
pass your file through the transformer, have three links coming out of it
pass id to all three, and the second column to the first link, the third column to the second link and the last column to the third link. Collect it via link collector. Your final target, collected file will have the result you desire.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
If you have the option to use Enterprise Edition, then I would recommed you to use that and use the plug-in stage known as the PIVOT STAGE.
This stage will result in a definite solution to your problem.
Where as in the server this can be done through a transformer as mentioned above.
The limitation would be that your positions for the pivot should be static.
This stage will result in a definite solution to your problem.
Where as in the server this can be done through a transformer as mentioned above.
The limitation would be that your positions for the pivot should be static.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Use the database Luke. Do something as follows in a DB stage:
Ogmios
Code: Select all
select ID, sales_typ1_amnt
from yourtable
union
select ID, sales_typ2_amnt
from yourtable
union
select ID, sales_typ3_amnt
from yourtable
In theory there's no difference between theory and practice. In practice there is.
Moreover :D ... if you want to keep the amnt's in order, something as:
Ogmios
Code: Select all
select ID, sales_typ1_amnt, '1' as order
from yourtable
union
select ID, sales_typ2_amnt, '2' as order
from yourtable
union
select ID, sales_typ3_amnt, '3' as order
from yourtable
order by ID, order
In theory there's no difference between theory and practice. In practice there is.
-
- Participant
- Posts: 97
- Joined: Tue Feb 21, 2006 6:45 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: