alter table 表名 add id int identity(1,1)

解决方案 »

  1.   

    ALTER TABLE 表名 ADD 列名 INT IDENTITY(1,1)
      

  2.   

    看错了,上面的是加一新字段。如何用语句添加或去除表字段的自增属性
    http://expert.csdn.net/Expert/topic/2217/2217137.xml?temp=.8302118
      

  3.   

    alter table TableName add ID bigint identity(种子,递增量)
      

  4.   

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

  5.   

    谢谢大家的热心帮助,问题已经解决,随后就会结贴加分。特别谢谢 txlicenhe(马可&不做技术高手) 朋友,欢迎以后多多指教,共同进步。