Big disadvantages of default is: 1. Immediately update all rows in table.
Interesting only if all or most already existed rows will use this value. 2. Less readable, this is important for me. I prefer this scenario: ALTER TABLE ... ADD null able; COMMIT; UPDATE ... COMMIT; ALTER TABLE ... ALTER ... SET NOT NULL; COMMIT; For backward compatibility (currently I must support FB2.5) I using this SP instead SET NOT NULL: CREATE OR ALTER PROCEDURE MASA$Set_Null_Flag(Relation_Name RDB$Relation_Name, Field_Name RDB$Field_Name, Not_Null SMALLINT) AS DECLARE major INTEGER; DECLARE ds VARCHAR(500); DECLARE nf VARCHAR(20); BEGIN major=COALESCE(SubStrFromStr(rdb$get_context('SYSTEM','ENGINE_VERSION'),'.',0),0); IF(major>=3)THEN BEGIN nf = ' DROP NOT NULL;'; IF(Not_Null = 1) THEN nf = ' SET NOT NULL;'; ds = 'ALTER TABLE '||TRIM(Relation_Name)||' ALTER '||TRIM(Field_Name)||nf; END ELSE BEGIN nf = 'NULL'; IF(Not_Null = 1) THEN nf = '1'; ds = 'UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = '||nf||' WHERE RDB$FIELD_NAME='''||TRIM(Field_Name)||''' AND RDB$RELATION_NAME='''||TRIM(Relation_Name)||''';'; END EXECUTE STATEMENT ds WITH AUTONOMOUS TRANSACTION; END Slavek On 13.10.2016 17:49, Jiří Činčura wrote: >> 1.add field with "default" > Which you can later remove. > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel