pagination with row number

Solutions on MaxInterview for pagination with row number by the best coders in the world

showing results for - "pagination with row number"
Jessica
09 Jan 2020
1DECLARE @Index INT;
2DECLARE @PageSize INT;
3
4SET @Index = 3;
5SET @PageSize = 5;
6
7SELECT *  FROM
8  (SELECT  ROW_NUMBER() OVER (ORDER BY EmpID asc) as MyRowNumber,*
9  FROM Employee) tblEmployee
10WHERE MyRowNumber BETWEEN ( ((@Index - 1) * @PageSize )+ 1) AND @Index*@PageSize