In mysql, I tried to modify an existing table as follows:
ALTER TABLE `etexts` CHANGE `etext` `etext` VARCHAR( 100 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT NULL
Got a response:
#1067 - Invalid default value for 'etext'
Why?
This is inconsistent ... NOT NULLbut make it the default NULL...Delete DEFAULT NULLand change NOT NULLto NULL:
NOT NULL
NULL
DEFAULT NULL
ALTER TABLE `etexts` CHANGE `etext` `etext` VARCHAR( 100 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL;
The NOT NULL column has a default value of NULL.
If you want it to be NULLable,
... COLLATE latin1_swedish_ci NULL
NULLABLE columns will default to NULL automatically if the column
Source: https://habr.com/ru/post/1762290/More articles:Changing a string based on a pattern - stringPrint long lines of text LaTeX / Sweave - rNSDateFormatter EEE working day problem - objective-cRecognizing notes in recorded sound - Python - pythonDisabling Quoatation - rsync from bash - bashкак вызвать С# webservice из java - javaTracing in NUnit only works when debugging from Visual Studio - visual-studioMS Access 2010: "sorting sequence not supported by the specified file format" - vbaCan I redirect a javascript request to another javascript action? - javascriptMySQL Custom Order - mysqlAll Articles