Sean McKeough wrote:
You're talking about changing the values from an alter add column?
You can't change the exists default other than by an update
statement...it's immutable once the column is added.
Uh... lots of confusion. Especially since DB2 Dev. lingo is now in the mix.
Let me try to consolidate:
You cannot alter the DEFAULT property before DB2 V8.2.
You can alter the property in V8.2 and higher.
Now, changing the default property does not affect any existing values
in the table, even if they were added using the DEFAULT keyword.
So far so good and presumably uncontested.
Sean now is talking about the "exist default" for added columns.
That is, if a column is added to an existin table with existing rows,
then there must be some sort of default which is chosen for those
existing rows.
DB2 does not acually update the table when you add a column.
the ALTER TABLE returns instantanious (well, pretty much, ...)
Instead DB2 logs a separate "exist default" for those rows in the
descriptors for the table.
Whenever a row is updated the exist default will be materialized.
It is independent from the "external" semantics of changing teh default
for new rows.
Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab