Need to alter a table to allow nulls on a column -- but cant drop the column...can I do this? Was trying something like:
ALTER TABLE myTable MODIFY myColumn NULL;
But to no avail....
This question is related to
sql-server
ALTER TABLE myTable ALTER COLUMN myColumn {DataType} NULL
where {DataType}
is the current data type of that column (For example int
or varchar(10)
)
Sure you can.
ALTER TABLE myTable ALTER COLUMN myColumn int NULL
Just substitute int for whatever datatype your column is.
For MYSQL
ALTER TABLE myTable MODIFY myColumn {DataType} NULL
Source: Stackoverflow.com