Is there any way to make a column that is initially declared nullable to not nullable?? The scenario is this:
I am migrating a table and want to insert default values only during migration. Once the migration is complete, I don't want to insert default values. At first, I did this:
db2 alter table test add col1 not null with default 0;
I can't have col1 generate a default value when running the application and I don't think there is any way to remove the default generation after the fact (is there??).
Next I tried this:
db2 alter table test add col1;
db2 update test set col1 = 0;
I need to now set col1 to NOT NULL...HOW DO I DO THAT?? Is it possible? Thanks for all help.
I am migrating a table and want to insert default values only during migration. Once the migration is complete, I don't want to insert default values. At first, I did this:
db2 alter table test add col1 not null with default 0;
I can't have col1 generate a default value when running the application and I don't think there is any way to remove the default generation after the fact (is there??).
Next I tried this:
db2 alter table test add col1;
db2 update test set col1 = 0;
I need to now set col1 to NOT NULL...HOW DO I DO THAT?? Is it possible? Thanks for all help.