有一个参数由于页面分页,where只是一个条件,加上就行了

解决方案 »

  1.   

    select identity(int,1,1) id, a.t1,a.t2,b.k1,b.c2 into #tmp from a,b where a.t1=b.t1select * from #tmp where id >10 and id <=20
      

  2.   

    见http://expert.csdn.net/Expert/topic/1197/1197059.xml?temp=.6152613
      

  3.   

    sky_blue(老衲)的方法遇到海量结果集的时候性能很差。
      

  4.   

    exec('SELECT Top '+@PageSize+' * FROM T WHERE 你的条件 and SortField NOT IN (SELECT TOP '+cast(@PageSize* @Pagei as varchar)+' SortField from T  where 你的条件)')