1 ALTER PROC [dbo].[TestProPage] 2 @Page INT=1, 3 @RowNum INT=5 4 AS 5 BEGIN 6 SELECT * FROM 7 (SELECT *,ROW_NUMBER() OVER(ORDER BY IndexID) AS num FROM dbo.SC_Index ) a 8 WHERE a.num BETWEEN (@Page-1)*@RowNum+1 AND (@Page)*@RowNum 9 END
SQL 分页,@page第几页,@RowNum一页显示多少条数据
原来数据库分页都是用 ID配合not in 使用,但一直觉得不太规范。