有数据的话
ALTER TABLE 表 ADD 编号1 bigint identity(1,1) not null
go
SET IDENTITY_INSERT 表 ON
go
update 表 set 编号1=编号
go
SET IDENTITY_INSERT 表 OFF
go
ALTER TABLE 表 DROP COLUMN 编号 
go
exec sp_rename '表.编号1','编号'
go

解决方案 »

  1.   

    没有数据的话
    ALTER TABLE 表 ADD 编号1 bigint identity(1,1) not null
    go
    ALTER TABLE 表 DROP COLUMN 编号 
    go
    exec sp_rename '表.编号1','编号'
    go
      

  2.   

    alter table drop column id
    alter table add id int identity(1,1)
      

  3.   

    alter table drop column id
    alter table add id int identity(1,1)
      

  4.   

    alter table drop column id
    alter table add id bigint identity(1,1) not null