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 are the enhancements made in datastage 7.5 compare with 7.0?
What are the types of containers and how to create them?
How will you move hashed file from one location to another location?
What is Ad-Hoc access? What is the difference between Managed Query and Ad-Hoc access?
What are the difference types of stages?
What is the importance of the exception activity in datastage?
What are routines in datastage? Enlist various types of routines.
What are the features of datastage flow designer?
Which warehouse using in your datawarehouse
project Steps,hits, Project level HArd things,Solved methods?
Describe the main features of datastage?
How can one find bugs in job sequence?
What are the different common services in datastage?
8000 jobs r there i given commit, suddenly job will abort? what happens? 2)diff b/t transformer stage & filter stage? 3)how to load the data in the source?
Name the third party tools that can be used in datastage?