Source Like
department_no, employee_name
----------------------------
20, R
10, A
10, D
20, P
10, B
10, C
20, Q
20, S

and Output should be like this

department_no, employee_list
--------------------------------
10, A
10, A,B
10, A,B,C
10, A,B,C,D
20, A,B,C,D,P
20, A,B,C,D,P,Q
20, A,B,C,D,P,Q,R
20, A,B,C,D,P,Q,R,S

Answers were Sorted based on User's Feedback



Source Like department_no, employee_name ---------------------------- 20, R 10, ..

Answer / subhash

small modification to the above ans:
SRC---->Transformer--->TGT
we do the 'HASH' partitioning on Dept_No.

SetNull value to the Stage variable----->SV_List

In the transformer stage variables:
SV_List :',' : Employee_Name ----->SV_List (Concatenating Employee
Names)

In the Column Derivation:
TRIM(SV_list, ',' , 'L')------->Employee_Name

Is This Answer Correct ?    5 Yes 1 No

Source Like department_no, employee_name ---------------------------- 20, R 10, ..

Answer / srinivas

By using the stage variables in transformer we can do this.

Before going to use transformer sort the data based on two columns.Order should be like below

Deptno Empname
10 A
10 B
SO ON...

After that in transformer take 3 stage varibles

stg1--->map the sorted Deptcolumn

stg2---> DSLink2.empname:',' (map the empname column and concatenate comma operator)

Stg2--->stg3:stg2 (concatenate first two staging varibles)


Then

In derivation of employee_list column (In transformer)

use below function

TRIM(stg3,',','T')---->employee_list (column derviarion)

It will gives you as expected result.

Thanks
Sri

Is This Answer Correct ?    5 Yes 3 No

Source Like department_no, employee_name ---------------------------- 20, R 10, ..

Answer / subhash

SRC---->Transformer--->TGT
we do the 'HASH' partitioning.

SetNull value to the Stage variable----->SV_List

In the transformer stage variables:
SV_List : Employee_Name ----->SV_List (Concatenating Employee
Names)

In the Column Derivation:
SV_list------->Employee_Name

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More Data Stage Interview Questions

hi i am bhavani, in real time data stage who is the source provide? and how to recevied in developer? Pls send me answer

1 Answers   Polaris,


What is difference between symmetric multiprocessing and massive parallel processing?

0 Answers  


What is difference between server jobs & parallel jobs?

0 Answers  


how can we extract data with out having any common column

7 Answers   IBM, Switch2iTech,


where the log files or tables can store in DS?

2 Answers   IBM,






what is snow flack schema?

2 Answers  


What is ds designer?

0 Answers  


in datastage interview qustion source target ------- ------- 12345 1 2 3 4 5

3 Answers   IBM, YCS,


how can i get 2nd highest salary in datastage?can u send me ,thanQ 2)if i had source has 2 records 1st record ie 1st column contains 1,2,3 and 2nd coulmn contains 10,10,10 i have to get target as 2nd columns as 20,30,40 how can i?

3 Answers   Accenture,


deptno wise to find max and min,and sum of rows and in target to company wise maximum

1 Answers   IBM, TCS,


What is lookup table?

5 Answers  


What is the purpose of pivot stage and types of containers in datastage

0 Answers  


Categories