想请教大家一下。用查询分析器怎么样用语法来创建一个含有自动增长功能的字段。。跟ACCESS的自动编号一样。谢过了。

解决方案 »

  1.   

    加个 IDENTITY ( seed , increment )
      

  2.   

    这个意思?
    create table tb(field int identity(1,1))
      

  3.   

    create table test(
    id int identity(1,1),
    test varchar(800)
    )
      

  4.   

    果真是难道一片人阿...create table t
    (
    id int identity(1,1) ,
    name varchar(10)
    )
      

  5.   

    create table tb(field int identity(1,1),a int)
    insert tb select 44
    union all select 32
    union all select 65
    union all select 66select * from tb
    drop table tb
      

  6.   

    create table tb(ID int identity(1, 1))
      

  7.   

    嘿嘿。我一个一个试一下。。3Q了。。CSDN就是好人多。
      

  8.   

    create table mytable(id int identity(1,1) , sessionid nvarchar(32) not null,name char(10) not null)
    这个可以创建谢谢大家了。
      

  9.   

    请问akuzou下面这些是什么意思。create table tb(field int identity(1,1),a int)
    insert tb select 44
    union all select 32
    union all select 65
    union all select 66select * from tb
    drop table tb
      

  10.   

    楼主的难倒一片人?identity是自增列函数
      

  11.   

    哈哈,朋友,以后不要说难道一片人了,至少在csdn是这样!
      

  12.   

    同意楼上 csdn里很多高人不露面地
      

  13.   

    楼主可以用企业管理器自己建一张有自动增长列的表,然后生成SQL脚本,自己看看SQL Server是怎么写的。
      

  14.   

    对下面的数字更改后查询结果不变? 为什么?
    create table tb(field int identity(1,1),a int)
    insert tb select 44
    union all select 32
    union all select 65
    union all select 66select * from tb
    drop table tb
      

  15.   

    create table #tp(F1 int identity(1,1), F2 int)insert into #tp (f2) select 100select * from #tpdrop table #tp
      

  16.   

    tsql
    identity
    jetsql
    autoincrement
      

  17.   

    用企业管理器自己建一张有自动增长列的表,然后生成SQL脚本,自己看看SQL Server是怎么写的。真是吓死一大片人
      

  18.   

    SQL>create table test(id int primary key,name varchar2(20))
    表已创建
    SQL>create sequence prodseq start with 1 increment by 1;
    序列已创建
    SQL>insert into product values(prodseq.nextval,'name1');
    创建1行
    SQL>insert into test values(prodseq.nextval,'name2');
    创建1行
    SQL>select * from test;
      

  19.   

    i int identity(1,1) [primary key]--从1开始每次加1
      

  20.   

    IDENTITY ( seed , increment )
      

  21.   

    我晕,这就难倒一片人啊。看看联机丛书的create table,不要太详细。
      

  22.   

    他有可能是杂一使用sql 2000以前的版本,没有IDENTITY这个关键字.