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
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
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
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
[x] [int] NULL ,
[y] [int] NULL
) ON [PRIMARY]
GO
传统做法:
1.alter table t1 add x1 int
2.update t1 set x1=x
3.alter table drop x
4.exec sp_rename 'x1','x'
update syscolumns set typestat =0 ,colstat=0 ,autoval =null where id=98099390 and name like 'x'
go