企业管理器-->右键你的表-->设计表-->选中一int类型字段-->下面有个属性叫“标识”的

解决方案 »

  1.   

    create table 表(id int identity(1,1),name varchar(100))
    insert 表 values('dali')
    select * from 表
      

  2.   

    alter table 表 add newfield int identity(1,1)
      

  3.   

    企业管理器中:
    创建一个表,将一个字段设为int型,然后在其下的属性选项中,选择Identity属性为yes,它自动设置起始值为1,以1为步长进行自动累加
    查询分析器中:
    CREATE TABLE [Employees] (
    [EmployeeID] [int] IDENTITY (1, 1) NOT NULL ,
    ....
    )其中IDENTITY (1, 1) 即是设置该字段起始值为1,以1为步长进行自动累加