select top PageSize * from( select row_number() over(order by id) as rows,* ) as t where rows > (PageSize*(PageIndex-1)) select * from( select row_number() over(order by id) as rows,* ) as t where rows between PageIndex*PageSize and PageIndex*PageSize+PageSize