I need to multiply a certain row in a DB2 table 18000 times. Some of the column values will remain as the original and some need to be incremented by 1.
I have very little knowledge in DB2 and I just can't find a concrete simple answer on how to do this. Can someone please give me an example on how to achieve this?
DB2 version: 9.7 / OS: Windows 2k8
For example I have the following table:
T_RES_TABLE
Col1 |Col2|Col3 |Col4|
----------------------
1 | 1| 1| 1|
What I need to achieve is:
T_RES_TABLE
Col1 |Col2|Col3 |Col4|
----------------------
1 | 1| 1| 1| - original
----------------------
2 | 1| 2| 1|
----------------------
.
.
.
----------------------
18000| 1|18000| 1|
So Col1 and Col3 need to increment and the rest must stay as is. Hope it's clear enough.
This will do your job. Just change it as your needs, change table name and column names and hit run. I dont know what you want to achieve but, it sounds you just need an Dummy Data in a table. So, i just make it for dummy purpose.
Modify it for your another requirements. The example below contains everything what you need, but you may have to modify according to that.
You can use a recursive query to generate new column values: