xytmj


----方法一----------------------------------------------------------------
select * from (select *, ROW_NUMBER() OVER (ORDER BY DeptName) as rownum from #tt) as tmpTable where rownum > ((@currpageno - 1) * @intPageSize) and rownum <= (((@currpageno - 1) * @intPageSize) + @intPageSize)

----方法二----------------------------------------------------------------
select top (@intPageSize) * from #tt where DeptName not in( select top ((@currpageno-1)*@intPageSize) DeptName  from #tt)

----方法三----------------------------------------------------------------

declare @no_show_recordcount int
select @no_show_recordcount = @show_recordcount - (@currpageno - 1) * @intPageSize

set @sql = \'select top  \'+convert(varchar, @intPageSize) +\'  * from ( select top \'+convert(varchar,@no_show_recordcount)+\' *  from #tt order by UserName desc ) a order by a.UserName asc\'

分类:

技术点:

相关文章: