DECLARE @PageNum AS INT;
DECLARE @PageSize AS INT;
SET @PageNum = 2;
SET @PageSize = 10;
WITH UserRN AS
(
SELECT ROW_NUMBER() OVER(ORDER BY [fldSno], fldUserType) AS RowNum
,fldUserID,
fldUserType,
fldName
FROM [CRP].[tblUserReg]
)
SELECT *
FROM UserRN
WHERE RowNum BETWEEN (@PageNum - 1) * @PageSize + 1
AND @PageNum
* @PageSize
ORDER BY RowNum, fldUserType
No comments:
Post a Comment