I am trying to add a column after another column while also specifying a default value. Below is my attempt that does not work.
alter table pageareas add content_userDefined BIT( 1 ) NULL default 0 after content;
If I remove "after content" it works:
alter table pageareas add content_userDefined BIT( 1 ) NULL default 0;
And if I remove "default 0" it works:
alter table pageareas add content_userDefined BIT( 1 ) NULL after content;
How can I accomplish adding it after a specified column while also defining a default value?
I am using MySql 5.1.36
If I'm reading the documentation for alter table correctly this time... you're only able to specify after or default, but not both. You could work around this by creating the column using after, and then altering it to have the default:
alter table pageareas add content_userDefined BIT( 1 ) NULL after content;
alter table pageareas alter content_userDefined set default 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With