Hi I tried to execute the below query to get results as paging manner
but when i tried to execute i'm getting error like Invalid column name 'RowNum'
can you try it once
DECLARE @PageNum AS INT;
DECLARE @PageSize AS INT;
SET @PageNum = 2;
SET @PageSize = 10;
WITH videosrn AS
(
SELECT ROW_NUMBER() OVER(ORDER BY videoid) AS RowNum
,videoid
,title
FROM videos
)
SELECT * FROM videos
WHERE RowNum BETWEEN (@PageNum - 1) * @PageSize + 1 AND @PageNum * @PageSize
ORDER BY videoid
thanks in advance