Page 1 of 1

Help in designing the job

Posted: Thu Apr 01, 2010 10:28 am
by devidotcom
Hi All,

I have the following requirement and have to design a job to meet the same.
The source Table A has to load target Table B with hierarchy information.

For Example
Table A

Parent Column Child Column
200 100
300 200
600 500
800 700
1000 900

Table B

Level_1 Level_2 Level_3
100 200 300
500 600 700
900 1000 1000

So basically the child 100's parent is 200 who's parent is 300. The child 900 has only one parent 1000 and hence the level_3 will have the same value as Level_3.
Here Level_1 is the lowest level.

Thanks

Posted: Thu Apr 01, 2010 10:35 am
by anbu

Code: Select all

select t1.parent, t1.child, t2.parent
from tablea t1 left outer join tablea t2
on t1.parent = t2.child
In transformer check if t2.parent is null if yes then assign t1.parent

Posted: Thu Apr 01, 2010 10:50 am
by devidotcom
Thank you!! Will code and post if resolved.