Subject Re: alter table syntax
Author skotaylor
--- In firebird-support@yahoogroups.com, "Nick Upson" <uebridger@h...>
wrote:
> it's not possible directly using alter table, your options are:
>
> alter table add newcol
> update set newcol = oldcol
> drop oldcol, etc

That's not an option as it would destroy the data I want to keep.

> there is an update to the system tables, posted by Ibrahim Bulut
>
> NOT NULL FIELD ==> NULLABLE FIELD
> ================================
> UPDATE RDB$RELATION_FIELDS
> SET
> RDB$NULL_FLAG=NULL
> WHERE
> (RDB$FIELD_NAME = 'FIELD_NAME') AND
> (RDB$RELATION_NAME='TABLE_NAME');

This is pretty much what I ended up with too. Thanks to WISQL I was
able to trace down the reference. :)

> DELETE FROM RDB$RELATION_CONSTRAINTS
> WHERE
> (RDB$CONSTRAINT_TYPE = 'NOT NULL') AND
> (RDB$RELATION_NAME = 'TABLE_NAME') AND
> (RDB$CONSTRAINT_NAME = 'INTEG_7');

This could be dangerous, 'INTEG_7' may not be the right reference.
How do I trace that reference to the right field name? (there are 3
other fields on that table that do need the 'NOT NULL' contraint)

I'm digging, but haven't been able to find where 'INTEG_x' is linked
to the right field name.

Thanks for not top posting.

Scott.