Subject Re: [ib-support] changing a column type to not null
Author Martijn Tonies
Hi Duilio,

> reading the ALTER TABLE ALTER COLUMN command on the langref, I am brought
> into thinking I can change the type of an existing column fron nullable to
> not null.
>
> However, I cannot find no way to put this into practice.
>
> Any hint ?

Yes - this simply isn't possible via the ALTER TABLE ALTER COLUMN clause.

The usual way of doing this is:

1) create a column with a different name, but the same datatype
2) transfer data from your original column to the new column
3) drop the old column and rename the new column

The NOT NULL attribute _can_ be changed via a direct system table
manipulation -
RDB$RELATION_FIELDS, field RDB$NULL_FLAG - but beware not to update
anything beyond that.

Alternatively, download yourself a copy of InterBase Workbench, start the
Table Editor,
change the checkbox and click Save.


Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."