create table t1 ( x int identity(1,1), y int )
go
insert t1 values (3)
insert t1 values (5)
go
select id from sysobjects where name like 't1'
select * from t1
-------------------------------------------------------
id          
----------- 
98099390(所影响的行数为 1 行)x           y           
----------- ----------- 
1           3
2           5

解决方案 »

  1.   

    update syscolumns set typestat =0 ,colstat=0 ,autoval =null  where id=98099390
    go
    insert into t1 values (1,3)
    insert into t1 values (4,3)
    select * from t1
    go
    ----------------------------------------------
    x           y           
    ----------- ----------- 
    1           3
    2           5
    1           3
    4           3
      

  2.   

    我这里测试也可以,不过
    update syscolumns set typestat =0 ,colstat=0 ,autoval =null  where id=98099390
    go
    应该改为:sp_configure 'allow updates', 1
    GO
    RECONFIGURE WITH OVERRIDE
    GOupdate syscolumns set typestat =0 ,colstat=0 ,autoval =null  where id=98099390
    gosp_configure 'allow updates', 0
    GO
    RECONFIGURE WITH OVERRIDE
    GO
      

  3.   

    暂时没有发现问题,转出的建表语句也变成了:CREATE TABLE [t1] (
    [x] [int] NULL ,
    [y] [int] NULL 
    ) ON [PRIMARY]
    GO
      

  4.   

    不同意更改系统表.
    传统做法:
    1.alter table t1 add x1 int
    2.update t1 set x1=x
    3.alter table drop x
    4.exec sp_rename 'x1','x'
      

  5.   

    更正:
    update syscolumns set typestat =0 ,colstat=0 ,autoval =null  where id=98099390 and name like 'x'
    go
      

  6.   

    就是把自增字段所对应syscolumns 记录中的typestat ,colstat,autoval 改为0,0,NULL
      

  7.   

    通过观察有些不同的是syscolumns 中的offset好像不同,不知道这个字段是什么含义。