Subject Re: [firebird-support] default value
Author Nick Upson
On 20/12/06, Markus Ostenried <macnoz@...> wrote:
> On 12/20/06, Nick Upson <nick.upson@...> wrote:
> > if I do this (there is 1 row already in the table)
> >
> > ALTER TABLE mytable add test Integer DEFAULT 0 NOT NULL;
> > commit;
> The default value you specified is only used if you are inserting a
> new record and if your insert statement does not contain the
> test-field.
> When altering a table like this the default isn't applied to already
> existing records. You should always execute an update statement after
> adding a not-null-field to fill the field for existing records
> yourself.
> bye,
> Markus

that's what I thought but :

SQL> ALTER TABLE tblsystemstatus add test Integer DEFAULT 0 NOT NULL;
SQL> commit;
SQL> select * from tblsystemstatus;

==================================== ============

hence my confusion