表已经在Mysql中建好了,而且我现在不能更改表。
现在导入数据需要ID字段自动添加,以前在建表的时候ID并不是设成自动增长的。
求高手!!!
现在导入数据需要ID字段自动添加,以前在建表的时候ID并不是设成自动增长的。
求高手!!!
解决方案 »
- ◆救命啊!mysql误删数据恢复◆
- SQL查询出来的统计怎么不对?
- 问下删除11W的数据怎么要 30 秒
- 请问查询介乎什么数之间是范围越小效率越高吗?
- 字段内容比查询关键字内容少,如何查找出字段内容包含在查询关键字中间
- 求mysql一条查询语句,或性能比较好的语句?
- 数据库查询问题 很怪异
- 请教几个mysql的问题...
- 求救:can not connect to mysql server(10061)是怎么回事?
- 一个比较复杂的SQL语句求助
- c连接 mysql问题 急!!!
- insert into product_intro(belong) select belong from product where bigclassname=
select ID=row_number()over(order by getdate()),
*
from tb
alter table test add id int IDENTITY (1,1)
*************************** 1. row ***************************
Table: t2
Create Table: CREATE TABLE `t2` (
`id` int(11) DEFAULT NULL,
`total` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.03 sec)mysql> alter table t2 modify id int auto_increment primary key;
Query OK, 0 rows affected (0.17 sec)
Records: 0 Duplicates: 0 Warnings: 0mysql> show create table t2\G
*************************** 1. row ***************************
Table: t2
Create Table: CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`total` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)mysql>