蠏碁 蟆朱. れ 豌 10螳 row 蟆郁骸 讌 螻, 11~ 15蟾讌 5螳 Row襯 襴危.
select productid, name
from adventureworks.production.product
order by name
offset 10 rows
fetch next 5 rows only
讀, れ 蟆郁骸螳 螳.
select productid, name
from (
select row_number() over(order by name) as rowid, productid, name
from adventureworks.production.product
) x
where rowid between 11 and 15
order by rowid
企一朱 覲 螳ロ.
use AdventureWorks
go
declare @numberofrows int = 10 -- number of rows you want on a page
declare @desiredpagenumber int = 5 -- page number
select *
from(
select rownum = row_number() over (order by employeeid), *
from humanresources.employee
) as a
where rownum > (@numberofrows * (@desiredpagenumber - 1))
and rownum <= (@numberofrows * (@desiredpagenumber - 1)) + @numberofrows
order by employeeid
select *
from humanresources.employee
order by employeeid
offset (@numberofrows * (@desiredpagenumber - 1)) rows
fetch next @numberofrows rows only;