You cant specify null
in ALTER TABLE
(although not null
is allowed)
See the below documentation and also this discussion on this toppic
Syntax
ALTER TABLE table {ADD {COLUMN field type[(size)] [NOT NULL] [CONSTRAINT index] | ALTER COLUMN field type[(size)] | CONSTRAINT multifieldindex} | DROP {COLUMN field I CONSTRAINT indexname} }
Old School Solution:-
- create a new temporray field as null with the same datatype
- update the new temporary field to the existing NOT NULL field
- drop the old NOT NULL field
- create the droped column with the same datatype again without NOT NULL
- update the existing field to the temporary field
- if there have been indices on the existing field, recreate these
- drop the temporary field