Page 1 of 1

Join stage: Need to retain the column key from both tables

Posted: Wed Aug 17, 2011 3:37 pm
by pdntsap
Hello,

I have a join stage joining data from Table A and Table B based on join key Column A. Is there a way by which Column A from both Table A and Table B can be retained at the output of the Join stage?

Thanks.

Posted: Wed Aug 17, 2011 3:44 pm
by ray.wurlod
Yes. Make an additional column in Table B that is a copy of the key and map that to the output.

Posted: Wed Aug 17, 2011 4:03 pm
by pdntsap
That was quick, Ray.

My inputs are flat (sequential) files and not tables as previously mentioned. Sorry about that. I used a Copy stage after the Sequential file stage to create an additional column that will be a copy of the key column but it looks like the same input column cannot be mapped to more than one output column in the Copy stage. I used a Transformer stage after the Sequential file stage and was able to create a copy of the key column. It seems to be fine but I need to some more testing and will update my post again.

Thanks again.

Re: Join stage: Need to retain the column key from both tabl

Posted: Thu Aug 18, 2011 6:31 am
by BI-RMA
Hi pdntsap,

I can't see why You are interested to see the content of the join Column A from table B when they are (by definition) identical (in inner and left outer joins). You can always map the key value to multiple output fields after the join by using a copy stage.

DataStage will , however, provide the key-columns from both tables when using full outer join mode (which makes a lot of sense).

Posted: Thu Aug 18, 2011 9:58 am
by pdntsap
Roland,

The join stage uses inner join and I need the key columns from both inputs for further processing downstream. Thanks for your suggestion of copy stage after the join stage. I believe copy stage might lead to better performance (in terms of processing time) than a transformer stage.