sqlserver,表中的一列,用于自动生成编号,怎么实现?
还有就是这一列可以作为主键吗?
谢谢大家!

解决方案 »

  1.   

    alter table tb add id int identity(1,1)可以做主健。但适不适合做主健,看你具体应用。
      

  2.   

    create table tb(ID int Identity(1,1) primary key,[Name] varchar(10))
      

  3.   


    --设置自增列alter table tb add 自增列字段 int identity(1,1) 
      

  4.   

    用sql语句建表怎么写法?
    还有就是一般bbs,如果用于帖子编号,做主键的话有什么问题?
      

  5.   

    alter table A alter 列名 int identity(1,1)
      

  6.   

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

  7.   

    IDintIdentity(1,1),括号里的1,1是什么意思啊
      

  8.   

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

  9.   

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

  10.   

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

  11.   

    用IDENTITY 
    语法
    IDENTITY [ ( seed , increment ) ]参数
    seed:装载到表中的第一个行所使用的值。increment:增量值,该值被添加到前一个已装载的行的标识值上。必须同时指定种子和增量,或者二者都不指定。如果二者都未指定,则取默认值 (1,1)。