MySQL - Remove default value for Datetime field
17,203
Solution 1
Yes, you can drop the default using an ALTER TABLE
statement like this:
alter table your_table
alter column your_column drop default;
Solution 2
To drop the default from multiple datetime columns in a table:
ALTER TABLE your_table
ALTER COLUMN columnname1 DROP DEFAULT,
ALTER COLUMN columnname2 DROP DEFAULT,
ALTER COLUMN columnname3 DROP DEFAULT,
....
Related videos on Youtube
Comments
-
NullReference over 1 year
An existing MySQL table has a DateTime field which is not null and having a Default Value set as '0001-00-00 00:00:00'. Is it possible to Alter this table to remove the default value for the DateTime field ?
-
AchrafGounane over 7 yearsI found this for you : stackoverflow.com/questions/11312433/…
-