select identity(int,100,1) as id into # from syscolumns a,syscolumns b

解决方案 »

  1.   

    1,建序数表
    select top 8000 identity(int,1,1) as N into numtab from 
    (select top 100 id=1  from sysobjects) as a,
    (select top 100 id=1  from sysobjects) as b,
    (select top 100 id=1  from sysobjects) as c2,
    select top 1 a.N from numtab a left join tt b 
    on a.N=b.a
    where b.a is null
    order by b.a
      

  2.   

    select identity(int,100,1) as id into # from syscolumns a,syscolumns b
    deleted  from # where id> (select max(a) from table)select id from # left table on id=a
    where a is null 
     
      

  3.   

    select identity(int,100,1) as id into # from syscolumns a,syscolumns b各位高手,这句话什么意思?看不明白
    identity(int,100,1)是函数吗
    syscolumns a,syscolumns b 又是什么表
    请详细说明一下。谢谢。
      

  4.   

    IDENTITY(函数)
    只用在带有 INTO table 子句的 SELECT 语句中,以将标识列插入到新表中。尽管类似,但是 IDENTITY 函数不是与 CREATE TABLE 和 ALTER TABLE 一起使用的 IDENTITY 属性。语法
    IDENTITY ( data_type [ , seed , increment ] ) AS column_name参数
    data_type标识列的数据类型。标识列的有效数据类型可以是任何整数数据类型分类的数据类型(bit 数据类型除外),也可以是 decimal 数据类型。seed要指派给表中第一行的值。给每一个后续行指派下一个标识值,该值等于上一个 IDENTITY 值加上 increment 值。如果既没有指定 seed,也没有指定 increment,那么它们都默认为 1。increment用来添加到 seed 值以获得表中连续行的增量。column_name将插入到新表中的列的名称。 
    syscolumns a,syscolumns b (系统表),自连接,笛卡儿集
    自己试试
      

  5.   

    select identity(int,100,1) as id into # from syscolumns a,syscolumns b
    产生从100开始的连续数
      

  6.   

    谢谢,明白了许多,我把
    select identity(int,100,1) as id into # from syscolumns a,syscolumns b在查询分析器里运行,怎么运行不会停了。增量一直在加没有停。怎么办。