select only new records (ODBC stage)

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
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

select only new records (ODBC stage)

Post by Luk »

Hi all!

I must select from sources only new records. In my source I have timestamps (MSSQL server binary8 timestamps). I'm using job parameter telling me what is the last number of previously loaded record and in transformer I'm rejecting old ones.

I'm wondering - is there some way to use this jobparmeter in ODBC stage to select there only new records??
Or is there another way to take from source only new records when we hav e timestamping in database and information (i.e. from file) what was the last row number previously loaded??
LUK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can use job parameters for constants in the WHERE clause of the SELECT statement.
Fill in the WHERE clause, without the word WHERE, on the Selection tab of the ODBC stage Output links properties.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

Post by Luk »

You can use job parameters for constants in the WHERE clause of the SELECT statement.
Fill in the WHERE clause, without the word WHERE, on the Selection tab of the ODBC stage Output links properties.
OK ray, but how (in what form) must I write job parameter ??

for example : I have parameter xxx - what is the proper form for ODBC stage WHERE clause window ??
LUK
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Under selection, you need to include

Table_TimeStamp >= #Last_Run_Control_TimeStamp#

As a good practice, you can also include the upper bound so the next run will carry from there.
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

Post by Luk »

thanks!!
now I know taht job parameter must be between '#' characters
LUK
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

Post by Luk »

one more quick question:

is there (in DS) possibility to apply to job parameter value from (for example) file??
LUK
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

If you wish to take the value of a parameter from a file, you need to first write some code to read the file and store the value(s) in the corresponding parameters. You can search for posts in the forum that can guide you through this.
Post Reply