select identity(int,1,1) rownum,* into #tmpselect * from #tmp

解决方案 »

  1.   

    select identity(int,1,1) rownum,* into #tmp from yourtableselect * from #tmp
      

  2.   

    我试了一下,这种方式可以实现。
    #tmp 是否临时表?
    如果是的话,当我有几个程序同时需要调用这段代码,会不会导致混乱?
      

  3.   

    select * from (select identity(int,1,1) rownum,name from 表)A where rownum>10 and rownum<=20一句就搞定了!
      

  4.   

    pengdali(大力)这句sql语句有没有做过测试?
      

  5.   

    IDENTITY(函数)
    只用在带有 INTO table 子句的 SELECT 语句中,以将标识列插入到新表中。
      

  6.   

    不好意思:
      select identity(int,1,1) rownum,name into #temp from 表
      select * from #temp where rownum>10 and rownum<=20
    对不起了!