Page 1 of 1

Comparing a record with the rest of the records in a table

Posted: Thu Aug 02, 2007 11:57 pm
by joesat
I have to pick the first record of a table. Then I need to compare a date field in the first record with the corresponding date field in the second record. Based on the comparison I will do some transformations. Then I will compare the first with the third, then the fourth and so on.

At the end of comparing with all the records, I will take the second record and compare with the third, fourth and so.

Is there any way to do this?

Thanks.

Posted: Fri Aug 03, 2007 1:32 am
by joesat
please guys...suggestions?

Posted: Fri Aug 03, 2007 1:46 am
by ray.wurlod
Etiquette Note
This is an all volunteer site. People post as and when they can. If you need urgent support, sign up with your support provider for premium service, and learn the true cost of urgent. DSXchange is not a substitute for a maintenance contract. That soneone has not posted within the hour might mean that they're asleep (it was the middle of the night in the USA when you posted) or busy earning a living.


There is no such thing as the first row in a table. It is one of the fundamental tenets of database theory that order of storage is irrelevant. This makes the remainder of your question/requirement flawed.

Posted: Fri Aug 03, 2007 6:10 am
by goutam
you can use stage variable of transformer stage to do the above operation. I have read from IBM datastage handbook that stage variables are mainly used for 1. handling NULL values in a transformer
2.comparing a current record.coulmn value with previous record.column value . I am just giving you the hint but i donot know how exactly it can be done.

Posted: Thu Aug 09, 2007 5:04 pm
by pbatchu
Hi Joe,
I did not understand exactly what you want to achieve. Are you looking for duplicate records.

You may identify record order (1st and 2nd), if you have primary key defined in the table and using surrogate key or sequence number (in increasing order). But order may not be that imporatant as you want to compare every record with the rest.

Without knowing exact purpose, it is hard to tell.

Some of the things, like finding duplicates can be easily achieved using SQL statement at database level.

- Pavan