View previous topic :: View next topic |
Author |
Message |
sakreg Beginner
Joined: 28 Feb 2005 Posts: 80 Topics: 26
|
Posted: Mon Jan 09, 2006 6:13 am Post subject: DB2 Update based on Count |
|
|
I have to update around 32,000 records in chunks of 5000 each. UPDATE Query at any time will fetch 32,000 records. But I need to update only the first 5,000. Is there a way to do this? |
|
Back to top |
|
|
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Mon Jan 09, 2006 7:49 am Post subject: |
|
|
Since SQL is a set oriented language, this will only work, if you are able to formulate aditional predicates in the WHERE-clause, that give you chunks of 5000 rows.
regards
Christian |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
sakreg Beginner
Joined: 28 Feb 2005 Posts: 80 Topics: 26
|
Posted: Mon Jan 09, 2006 9:22 am Post subject: |
|
|
CZerfas,
Thats what is making life more harder. I have chosen 5000 as ~ 5500 records can only be processed by the Task (which runs under IMS BMP and updates DB2 and the design is in a way that there is no Checkpoint). This is a very rare scenarion as the design is actually based on with few hundreds and that is what was happening so far.
I tried with many predicates, but that result varies and I am pushed to re-run the same task for about more than 20 time
So I would be if there is a way to control the number of records that are been updated in a single run giving me the exact count of records as expected
kolusu,
I can not do that way, as I would have to delete the rows after unloading and then load back with the required indicator for the task to process the allowed number of records.
So I am basically looking for a SQL that can limit the Update after it has reached some 5000 records, neglecting the rest (which also meets the same criteria for updation) |
|
Back to top |
|
|
|
|