您的位置:首页 > 数据库

SqlServer 2008R2 分页查询语句写法

2017-06-14 09:29 162 查看
SqlServer 2008R2分页新写法

--以前的写法-必须借助row_number()函数来获取行的序列号
Select *
from
(
select
ROW_NUMBER() over(order by name asc)  as __tempId,
* From (select t.*  from student t)as a
)as a
Where a.__tempId between 1 And 10
--现在的写法-用offset 与 fetch next 来处理
select t.*
from student t
order by t.name asc
offset 0 rows fetch next 10 rows only
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  sql server