现在我想插入一条记录,
ID值是int型,我想插入一条记录就ID递增
-------------------------------------
帮我写写-------------------------------------

解决方案 »

  1.   

    id int identity(起始值,自增值)
      

  2.   

    insert into tb (id,col2,col3,col4...) values(id自增值,列值2,列值3,列值4..)
      

  3.   

    alter table tb add id int identity(1,1)
      

  4.   

    #1. 在表设计器中修改identity属性
    #2. 先删除ID字段,再增加字段ID identity
    alter table tb
    drop column id
    go
    alter table tb
    add id int identity(1,1)
    go
      

  5.   

    create  table  表名(       id    int  not  null  identity(1,1)
           ……
    )
      

  6.   

    如果表中id列存在数据 这句SQL会报错
    详情LOOK

    http://topic.csdn.net/u/20110312/01/54c1fbf7-3ae3-4bb2-a79c-3a70bbdd06b3.html
      

  7.   

    select identity(int,1,1) as id 
    into A
    from B