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

测试代码
;with 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
 
  

 

 

解决:高版本

或者修改重复值的数据

posted @ 2020-06-18 17:40  郭大侠1  阅读(503)  评论(0编辑  收藏  举报