Last Record

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
kris_r
Participant
Posts: 32
Joined: Mon Jun 26, 2006 3:09 am
Location: bangalore

Last Record

Post by kris_r »

Hi,
I want to know how to extract the last record of a particular column.
I have 2 columns
A B
1 2
2 3
3 NULL

B should have one value greater than A. The last Record of A should be null. How to extract the last record of A..
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Hi,

Use aggregator stage choose "Last" aggregation function in derivation....

Thanks,
Anupam
kris_r
Participant
Posts: 32
Joined: Mon Jun 26, 2006 3:09 am
Location: bangalore

Post by kris_r »

But, how to assign NULL to that particular last record?
kris_r
Participant
Posts: 32
Joined: Mon Jun 26, 2006 3:09 am
Location: bangalore

Post by kris_r »

Any idea Guys?
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

Hi

With a transformer you can assign what you want to the last record.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Hi,

In transformer use @NULL...


Thanks,
Anupam
kris_r
Participant
Posts: 32
Joined: Mon Jun 26, 2006 3:09 am
Location: bangalore

Post by kris_r »

In the same column B, I should increment all the values by One, but the last value should be NULL.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Can you provide source data example how it is ?

Thanks,
Anupam
kris_r
Participant
Posts: 32
Joined: Mon Jun 26, 2006 3:09 am
Location: bangalore

Post by kris_r »

I have 2 columns A & b.
The column A contains 1,2,3. The Output should be like below:

A B
1 2
2 3
3 NULL
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

What about an update after the load, like

Code: Select all

update tgt set b=null where a=(select max(a) from tgt)
Success consists of getting up just one more time than you fall.
kris_r
Participant
Posts: 32
Joined: Mon Jun 26, 2006 3:09 am
Location: bangalore

Post by kris_r »

Hey loveojha2 :) ! Thanks, it worked.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

kris_r wrote:Any idea Guys?
Etiquette Note
This is an all volunteer site. Folks post as and when they can. If you want urgent answers sign up with your support provider for premium service and learn the true cost of "urgent". Don't push. Not everyone is in your time zone, and we do need our sleep.
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