On 24-4-2018 09:34, liviuslivius [email protected] [firebird-support] wrote: > > > Hi, > I need to add Field not null constraint with my custom name. > in previous versions of Firebird we can do: > 1. ALTER TABLE XXX ADD FIELDX INTEGER CONSTRAINT NK_XXX__FIELDX NOT NULL;
Interestingly, that syntax is not documented in the Firebird 2.5 language reference. > 2. UPDATE TABLE XXX SET FIELDX=some calculations; > Now in Firebird 3 this is prohibited on table with data. It is prohibited, unless you apply a default. > Then i do this on FB3. > 1. ALTER TABLE XXX ADD FIELDX INTEGER; > 2. UPDATE TABLE XXX SET FIELDX=some calculations; > 3. Add not null - how? I see only ALTER TABLE XXX ALTER FIELDX SET NOT > NULL; there are not place for constraint name > i need to add Field not null constraint with my custom name. alter table xxx add constraint NK_XXX__FIELDX check (fieldx is NOT NULL) Internally, a `not null`-constraint is just a check constraint. Mark -- Mark Rotteveel
