I am facing an issue while entering data into column which has been set nullable false,How can I change this to nullable true using sql .I am using mysql database
Asked
Active
Viewed 157 times
-3
-
2[How do I modify a MySQL column to allow NULL?](http://stackoverflow.com/questions/212939/how-do-i-modify-a-mysql-column-to-allow-) – Lukasz Szozda Dec 17 '15 at 17:57
-
Check out ALTER TABLE in MySQL doc – DBug Dec 17 '15 at 18:00
1 Answers
0
Use this:
ALTER TABLE MYTABLE
CHANGE COLUMN MYCOLUMN MYCOLUMN VARCHAR(10) NULL;
MYTABLE
is the table name, MYCOLUMN
is the column name. The important bit is the NULL
at the end, that will make the column nullable. Note that you have to repeat the whole column definition. I used VARCHAR(10)
in the example, but you have to adapt it to your column, setting default value and other options, if necessary.

Marcovecchio
- 1,322
- 9
- 19