Subject | Re: [ib-support] changing a column type to not null |
---|---|
Author | Helen Borrie |
Post date | 2002-05-07T12:42:15Z |
At 01:43 PM 07-05-02 +0200, you wrote:
<alt_col_clause> = TO new_col_name
| TYPE new_col_datatype
| POSITION new_col_position
1. Cleanest solution: create a new table with the desired attributes on
its columns and pump the
data. Do a RECREATE TABLE (Firebird) or DROP and CREATE on the original,
adding the new constraint, and re-pump.
2. Add before insert and before update triggers to check and (if desired)
default the value (this won't be helpful if you are seeking to place a
unique or primary key constraint on the column).
-- H
All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________
>reading the ALTER TABLE ALTER COLUMN command on the langref, I am broughtThe langref gives this extension (only) for ALTER TABLE...ALTER COLUMN:
>into thinking I can change the type of an existing column fron nullable to
>not null.
<alt_col_clause> = TO new_col_name
| TYPE new_col_datatype
| POSITION new_col_position
>However, I cannot find no way to put this into practice.Two options:
>
>Any hint ?
1. Cleanest solution: create a new table with the desired attributes on
its columns and pump the
data. Do a RECREATE TABLE (Firebird) or DROP and CREATE on the original,
adding the new constraint, and re-pump.
2. Add before insert and before update triggers to check and (if desired)
default the value (this won't be helpful if you are seeking to place a
unique or primary key constraint on the column).
-- H
All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________