Hi All,
I have a requirement in which I have to read all the source rows (only one column in each row) and load them into a single column in target. The no of rows is not fixed.
Example:
Input Data:
A
B
C
D
E
F
G
Output Data:
ABCDEF
Any idea how we can do this. I have done the pivot but it is populating the records into different columns where as i want it to be single column.
Thanks
Populate all rows in a single column
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 71
- Joined: Mon Nov 13, 2006 12:40 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I'd use a stage variable to accumulate the list. Generate a constant "key" column and use LastRecordInGroup() as a constraint, or use a downstream RemoveDuplicates stage set to "Keep Last".
You could use a Pivot stage and a Column Export stage, but that'd be using a sledgehammer to crack a nut.
You could use a Pivot stage and a Column Export stage, but that'd be using a sledgehammer to crack a nut.
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.
-
- Premium Member
- Posts: 353
- Joined: Mon Jan 17, 2011 5:03 am
- Location: Mumbai, India
If your source is a Sequential File then, read all the rows in a single column i.e. mention final delimiter is "none".
And in the transformer, use Convert function to replace new lines characters.
And in the transformer, use Convert function to replace new lines characters.
Code: Select all
Convert(char(10) : char(13),'',<SRC_COL>)
Thanx and Regards,
ETL User
ETL User
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I didn't actually have to do any of that. DataStage took care of the line terminators while reading the file - the constraint expression did not pass any empty line.
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.
-
- Premium Member
- Posts: 71
- Joined: Mon Nov 13, 2006 12:40 am