开发者

an error occurred while merging the default value and auto increment

开发者 https://www.devze.com 2023-01-16 18:16 出处:网络
SQL query: ALTER TABLE `x` CHANGE `y` `y` INT( 9 ) UNSIGNED NOT NULL DEFAULT \'1000\' AUTO_INCREMENT MySQL said:

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

精彩评论

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