View previous topic :: View next topic
|
Author |
Message |
Sriram K
New User
Joined: 17 Feb 2009 Posts: 32 Location: Bangalore
|
|
|
|
Hi,
A new coloumn is introuced in a table, for which i have to load the default value. There are more than 1 lakh rows in table for which i have update the new column with the defaule value.
To achieve this update i understood, without giving where clause the query runs faster. But after 10,000 reocrds or so its getting rolled back since no commit statement was there. Do we have any other utility or way to do that?
Dynamically preparing a query for each and every row is also possible but i dnt knw about the effectivness of that!
--------------------------------------------------------------------------------
My query is just to update a particular coloumn with default value. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
The default value should have been specified when the column was added to the table. |
|
Back to top |
|
|
Sriram K
New User
Joined: 17 Feb 2009 Posts: 32 Location: Bangalore
|
|
|
|
The default value will keep changing after every six months as per our requirement. Hence we haven't defined the table with default value.
So we planned to run an update for those?
Any utility or any other way it can be achieved? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
either- update thru a cursor and dedicate a weekend to running the job
- dump the table and generate the current default value with your dump SQL and then reload the table.
Since you have to modify modules performing an INSERT,
you could obtain the 'current default value' from a control table.
I believe Default Values are those that DB2 uses when there is no value provided by the INSERT SQL.
Thus, if you have a value for the column, db2 will use that and not the DEFAULT Value.
I think y'all mis-interpreted the actions taken by db2 for a DEFAULT Value.
You should have used the DEFAULT VALUE clause in the ALTER statement. |
|
Back to top |
|
|
|