alter table tablename alter id int 是无法去掉id列的自增属性。

    修改系统表(这种方法风险很高,可能导致不可预知的结果)   

sp_configure 'allow updates',1
go

reconfigure with override
go

update syscolumns set colstat=colstat&0x0000
where id=object_id('表名') and name='列名'
go

sp_configure 'allow updates',0
go

  新增列,赋值,删除旧列,重命名新列

alter table tablename add id1 int
update tablename set id1=id
alter table tablename drop column id
exec sp_rename 'id1','id','column'

      非SQL的方法很简单,就是在设计列的属性框中修改。

 posted on 2016-09-08 20:43  会飞的金鱼  阅读(1030)  评论(0)    收藏  举报