I want to make a database query with pagination. So, I used a common-table expression and a ranked function to achieve this. Look at the example below.
decla
@pagenumber=5 @pagesize=5
Create a common table expression and write logic like this
Between ((@pagenumber-1)*(@pagesize))+1 and (@pagenumber *@pagesize)