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

解决方案 »

  1.   

    pengdali(大力)的方法可以的
    还有一个方法就是 
    先导入临时表
    select IDENTITY(int,1,1) as rid,* into #tmp  from  yourtable
    然后drop yourtable 
    再重建表
    不过这方法对与数据量大的话 就不太合适了
      

  2.   

    对!黑GG的方法也可以!select IDENTITY(int,1,1) as rid,* into #tmp  from  yourtable
    drop table yourtable 
    select #tmp into yourtable
      

  3.   

    对!黑GG的方法也可以!select IDENTITY(int,1,1) as rid,* into #tmp  from  yourtable
    drop table yourtable 
    select * into yourtable from #tmp:)