I’m unable to run this query, where can be the error, because it’s ok., thanks
CREATE PROCEDURE Test
@PageSize int,
@PageNumber int
AS
SELECT
PK_ID, Test, Descripcion
FROM
(SELECT
PK_ID, Test, Descripcion,
ROW_NUMBER() OVER (ORDER BY Test, PK_ID) AS RowNumber
FROM
Mydatabase
) AS Test
WHERE
RowNumber BETWEEN @PageSize * @PageNumber AND @PageSize * (@PageNumber)
Depending on how your pages are numbered (starting from 0 or from 1), you should probably change your
WHEREclause to one of these:If the page numbers start from 0:
If the page numbers start from 1: