合并默认值和自动增量时出错
SQL查询:
ALTER TABLE `x` CHANGE `y` `y` INT( 9 ) UNSIGNED NOT NULL DEFAULT '1000' AUTO_INCREMENT
MySQL表示:
文档 1067 - “y”的默认值无效 默认值是否可以与mysql中的自增结合使用
正确的MySQL语法是什么?
SQL query:
ALTER TABLE `x` CHANGE `y` `y` INT( 9 ) UNSIGNED NOT NULL DEFAULT '1000' AUTO_INCREMENT
MySQL said:
Documentation 1067 - Invalid default value for 'y'
whether the default value can be combined with auto increment in mysql
What is the correct MySQL syntax?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该可行:
您只是无法定义 auto_increment 的默认值。
This should work:
You just can't define default value for auto_increment.
听起来你想要做的是设置 AUTO_INCRMENT 的起始值。您可以通过以下方式执行:
ALTER TABLE x AUTO_INCRMENT=1000
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