在每次提交前執行:
DBCC CHECKIDENT (jobs, RESEED, 你想要遞增的起始值)

解决方案 »

  1.   

    --有数据就用
    DBCC CHECKIDENT (表名, RESEED, 1)  --1就是重新从1开始--没有数据的话,也可以用:
    truncate table  表名
      

  2.   

    另附:
    當設置SET IDENTITY_INSERT dbo.數據表 on 後,可插入遞增列的值
      

  3.   

    用临时表处理:
    select identity(int,1,1)as 自增列名,字段名(除自增字段) into #temp from        your_table_name
    drop table your_table_name
    select * into your_table_name from #temp
    select * from your_table_name
      

  4.   

    DBCC CHECKIDENT 并不能够使已经有的数据进行重排,我是想让已经存在的数据里边的自增型自段重新排列
      

  5.   

    midnight2002的方法可行,但如果表的数量比较多,或者表的数据比较多那岂不要很长的时间?
      

  6.   

    删除标识字段,再重新创建就可以了alter table 表 drop column 标识字段
    go
    alter table 表 add 标识字段 int identity(int,1,1)
      

  7.   

    declare @num numeric(10)
    set @num=0
    update table 
    set @num=id=@num+1   --從1遞增
      

  8.   

    alter table 表 drop column 标识字段
    go
    alter table 表 add 标识字段 int identity(int,1,1)
    ---------------------------------------------------
    这个办法比较好