Hi,
I have a job where I extract the Results and get the Max ID of the Target Table and add 1 to write to the Target. I have taken the MAx id and add 1 to my Job. But since the Target File is a Big file, i am not able to Get the max id. IS ther any way to get the max Id of the Target table?
Cheers
How to Get the Max ID of the Target Table in the Job
Moderators: chulett, rschirm, roy
How to Get the Max ID of the Target Table in the Job
Victor Auxilium
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The usual way is to rely upon indexing in the target database, and to use a user-defined SQL expression such as
This always returns one row, which you can pre-load into a hashed file (with a constant as the key value) or other temporary location for subsequent use in your job. Or you could pick it up in a Routine that is used to initialize the value of a stage variable that is incremented within your job.
There are many possible solutions, but most start with that SQL statement.
Code: Select all
SELECT MAX(keycolumn) FROM tablename;
There are many possible solutions, but most start with that SQL statement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.