表已经在Mysql中建好了,而且我现在不能更改表。 现在导入数据需要ID字段自动添加,以前在建表的时候ID并不是设成自动增长的。 求高手!!!在MS-SQL中设置成自增列就好了 在MYSQL中不清楚 SQL code: insert ta select ID=row_number()over(order by getdate()), * from tb
SQL code: alter table test drop column id alter table test add id int IDENTITY (1,1)
删除原来的列,再新建一个自增的列 SQL code: insert into tb select id=identity(int,1,1) ,* from tb