国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > SQL Server > 正文

sql server實現分頁的方法實例分析

2020-07-25 12:40:54
字體:
來源:轉載
供稿:網友

本文實例講述了sql server實現分頁的方法。分享給大家供大家參考,具體如下:

declare @index int,@num intset @index = 1--當前頁set @num = 2--單頁包含的行數--分頁1select top (@num) *from ppohdwhere doccode not in(  select top (@num * (@index -1)) doccode  from ppohd  order by doccode)order by doccode--分頁2select top (@num) *from ppohdwhere doccode >=(  select max(doccode)  from  (    select top (@num * (@index - 1) + 1) doccode    from ppohd    order by doccode  ) as tb)--分頁3select top (@num) *from(  select ppohd.doccode as 'mydoccode',row_number() over (order by doccode) as sno,*  from ppohd) as tbwhere tb.sno >= @num * (@index - 1) + 1--分頁4select *from(  select ppohd.doccode as 'mydoccode', row_number() over(order by doccode) as sno,*  from ppohd) as tbwhere tb.sno between (@num * (@index - 1) + 1) and (@num * @index)

更多關于SQL Server相關內容感興趣的讀者可查看本站專題:《SQL Server分頁技術總結》、《SQL Server查詢操作技巧大全》、《SQL Server存儲過程技巧大全》、《SQL Server索引操作技巧大全》、《SQL Server常用函數匯總》及《SQL Server日期與時間操作技巧總結》

希望本文所述對大家SQL Server數據庫程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沈丘县| 蒙山县| 清新县| 洛南县| 万荣县| 宝丰县| 阳山县| 图们市| 绍兴市| 元谋县| 琼结县| 武汉市| 南通市| 乾安县| 亳州市| 庆元县| 措美县| 木里| 清水河县| 平乡县| 上杭县| 板桥市| 乐至县| 兴海县| 杭州市| 乐安县| 若尔盖县| 额敏县| 巴彦淖尔市| 玛纳斯县| 永定县| 渝北区| 昂仁县| 荔浦县| 雷山县| 盐城市| 恭城| 竹北市| 上思县| 曲靖市| 毕节市|