How to get the sequence number in datastage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
bunu1977
Participant
Posts: 35
Joined: Thu Oct 16, 2003 4:46 am

How to get the sequence number in datastage

Post by bunu1977 »

Hi,
I am trying to get a sequential number in datastage.For example if I have 100 rows in my source, the couner column should contain 1 to 100.
How to do it in datastage?

Regds,
DD
Dilip Das
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Re: How to get the sequence number in datastage

Post by raju_chvr »

Do you need the row number or a number that has to be generated for Surrogate key which is unique every time you run this job and insert data into DW.

for the latter: keyMgtGetNextValue('<key>') shld be used.
bunu1977
Participant
Posts: 35
Joined: Thu Oct 16, 2003 4:46 am

Re: How to get the sequence number in datastage

Post by bunu1977 »

Thanks,

I have got it using @INROWNUM function.

Regds,
Dilip
Dilip Das
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Re: How to get the sequence number in datastage

Post by raju_chvr »

that is right for the row number coming into the Transformer.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

@OUTROWNUM may be a better choice.

If you later add constraints to your Transformer stage, you will get gaps in the number sequence (which may not matter if they are only being used for uniqueness).

@INROWNUM counts the rows coming in to a Transformer stage.
@OUTROWNUM counts the rows leaving a Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply