Create table New_Table
(
ID     int identity(1,1) not null,
field1 char(10)          null,
...
fieldn nvarchar(255)     null
)
以上代码中ID  int identity(1,1) not null,这一行就是你所想知道的。

解决方案 »

  1.   

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

  2.   


    create table aaa (a uniqueidentifier,b int identity(1,1))
    go
    insert aaa values(newid())
    insert aaa values(newid())
    insert aaa values(newid())
    go
    select * from aaa
    go
      

  3.   

    TRY:
    Create table New_Table
    (
    [ID] [int] IDENTITY (1, 1) NOT NULL 
    field1 char(10)          null,
    ...
    fieldn nvarchar(255)     null
    )