写一个对特定表进行分页显示的存储过程,要求有两个参数一个是 每页显示的记录的条数(@pagesize),第二个是显示第几页(@pageIndex)
use TextSchool
select * from T_Student
create proc usp_MyStudent_GetDateByPageIndex
@pageSize int=5,
@pageIndex int
as
begin
select * from
(select *,ROW_NUMBER() over(order by Fstuid) as rowIndex
from T_Student)as tbl
where tbl.rowIndex between(@pageSize*(@pageIndex-1)+1) and (@pageSize*@pageIndex)
end
测试:查看第三页,每页3行数据
exec usp_MyStudent_GetDateByPageIndex 3,3