sqlserver使用窗口函数实现分页
ALTER PROC [dbo].[usp_GetStuPage]
@pageIndex INT =1,--当前页码
@pageSize INT =10,--页容量
@pageCount int OUTPUT--输出总页数
AS
BEGIN
SELECT @pageCount=CEILING((COUNT(id)*1.0)/@pageSize) FROM StudentsInfo
SELECT * FROM (
SELECT *,ROW_NUMBER() OVER(ORDER BY id) AS rownum FROM StudentsInfo
)AS t WHERE t.rownum BETWEEN (@pageIndex-1)*@pageSize+1 AND @pageIndex*@pageSize
END
中国足彩网信息请查看IT技术专栏