Subject | Re: [firebird-support] Default value in DDL not work |
---|---|
Author | Mark Rotteveel |
Post date | 2019-06-05T16:39:09Z |
On 5-6-2019 10:22, m_brahim11@... [firebird-support] wrote:
('somevalue', null)` then the default will not be applied because you
explicitly set the field to null.
A default will only be applied if you omit the field: `insert into
yourtable (other_field) values ('somevalue')`. After this statement,
`FIELD_NAME` will have value 0.
If that is not your use case, please show a reproducible example so we
understand what you mean.
Mark
--
Mark Rotteveel
> I build tables under IBEXPERT and define some fields with default valueIf you do `insert into yourtable (other_field, field_name) values
>
> FIELD_NAME INTEGER DEFAULT 0
>
> I except 0 as value but has always NULL
>
> Any idea ?
('somevalue', null)` then the default will not be applied because you
explicitly set the field to null.
A default will only be applied if you omit the field: `insert into
yourtable (other_field) values ('somevalue')`. After this statement,
`FIELD_NAME` will have value 0.
If that is not your use case, please show a reproducible example so we
understand what you mean.
Mark
--
Mark Rotteveel