Input Data is:
Emp_Id, EmpInd
100, 0
100, 0
100, 0
101, 1
101, 1
102, 0
102, 0
102, 1
103, 1
103, 1
I want Output
100, 0
100, 0
100, 0
101, 1
101, 1
Means Indicator should either all ZEROs or all ONEs per
EmpId.
Impliment this using SQL and DataStage both.
Answer Posted / shar
Ok
1) sql:
select empno, rank() over(order by empno) Ind from e2;
then we get:
100 1
100 1
100 1
101 2
101 2
103 3
2) Datastage:
sequl file-->sort-->tx--> Target.
@sort:
create keychange column then we get
100 0
100 1
100 1
101 0
101 1
101 1
102 0
102 1
103 0
@ Tx use two stage variables:
sv1 integer = 0 value
sv2 integer = 0 value
and at derivations :
assign
1) keychange ---> sv1
2) if sv1=0 then sv2+1 else sv2 ----> sv2
map the columns empno and sv2
and we get the results.
Thats it.
shar
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the sortmerge collector?
What are the different types of lookups in datastage?
What could be a data source system?
What are the functionalities of link collector?
Why fact table is in normal form?
Lookup constraints
Can you define merge?
What are the differences between datastage and informatica?
Name the command line functions to import and export the DS jobs?
What is the command line function to import and export the ds jobs?
Which warehouse using in your datawarehouse
describe the Steps to confiure a Qlogic switch
How many types of views are there in a datastage director?
sed,awk,head
How to write a expression to display the first letter in Caps in each word using transformer stage ? Please let me know ASAP Thanks in advance...