当前位置:Gxlcms > 数据库问题 > sql server新增自增列有重复值(2005 9.0.1399)

sql server新增自增列有重复值(2005 9.0.1399)

时间:2021-07-01 10:21:17 帮助过:5人阅读

a as ( select 1 as id1 ,2 as id2 union all select id1+1,id2+1 from a where id1<=10000000 ) select * into test6 from a option(maxrecursion 0)

 

 前提:
sql server2005  9.0.1399
管理员权限
test6表为1000W行数据表,有id1,id2 2个 int 型字段
想要添加自增列主键:
alter table test6 add  id6 int identity(1,1) primary key
技术图片    技术图片

 

 

解决:高版本

或者修改重复值的数据

sql server新增自增列有重复值(2005 9.0.1399)

标签:serve   ima   option   select   identity   prim   alt   src   图片   

人气教程排行