select top 50 * from 表

解决方案 »

  1.   

    select top 50 * from 表 order by 字段
      

  2.   

    select top 50 * from yourtable
      

  3.   

    select identity(int,1,1) as idd,* into #t from yourtable
    select * from #t where idd between 50 and 100
    drop table #t
      

  4.   

    select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表
    select * from #temp where ID_Num between 10 and 20
      

  5.   

    select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表
    select * from #temp where ID_Num between 10 and 20或:declare @SQLStr varchar(8000)
    set @SQLStr='SELECT Top '+cast(@每页大小 as varchar)+' * FROM 表 WHERE 主键列 NOT IN (SELECT TOP '+cast(@每页大小*@第几页 as varchar)+' 主键列 from 表 )'
    exec(@SQLStr)