Alter a MySQL column to be AUTO_INCREMENT(将 MySQL 列更改为 AUTO_INCREMENT)
问题描述
我正在尝试修改一个表以使其主键列 AUTO_INCREMENT
事后.我尝试了以下 SQL,但收到了语法错误通知.
ALTER TABLE 文档ALTER COLUMN document_id AUTO_INCREMENT
我做错了什么还是不可能?
<前>+--------------------+|版本() |+--------------------+|5.0.75-0ubuntu10.2 |+--------------------+
ALTER TABLE document MODIFY COLUMN document_id INT auto_increment
I’m trying to modify a table to make its primary key column AUTO_INCREMENT
after the fact. I have tried the following SQL, but got a syntax error notification.
ALTER TABLE document
ALTER COLUMN document_id AUTO_INCREMENT
Am I doing something wrong or is this not possible?
+--------------------+ | VERSION() | +--------------------+ | 5.0.75-0ubuntu10.2 | +--------------------+
ALTER TABLE document MODIFY COLUMN document_id INT auto_increment
这篇关于将 MySQL 列更改为 AUTO_INCREMENT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!