开发者

an error occurred while merging the default value and auto increment

SQL query:

ALTER TABLE `x` CHANGE `y` `y` INT( 9 ) UNSIGNED NOT NULL DEFAULT '1000' AUTO_INCREMENT

MySQL said:

Documentatio开发者_运维技巧n 1067 - Invalid default value for 'y' whether the default value can be combined with auto increment in mysql

What is the correct MySQL syntax?


This should work:

ALTER TABLE `x` CHANGE `y` `y` INT( 9 ) UNSIGNED AUTO_INCREMENT

You just can't define default value for auto_increment.


Sounds like what you want to do is set the starting value of the AUTO_INCREMENT. That you do by:

ALTER TABLE x AUTO_INCREMENT=1000

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜