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

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

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

2024-08-31 01:04:44
字體:
來源:轉載
供稿:網友

本文實例講述了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數據庫程序設計有所幫助。


注:相關教程知識閱讀請移步到MSSQL教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 嫩江县| 三江| 观塘区| 虞城县| 雅江县| 日照市| 盐津县| 南安市| 舒兰市| 综艺| 克拉玛依市| 苏州市| 深水埗区| 张家口市| 小金县| 定州市| 义马市| 抚顺市| 华宁县| 南部县| 肇州县| 怀柔区| 黄浦区| 乌海市| 宁城县| 蒲江县| 荣成市| 宾阳县| 佳木斯市| 阿坝县| 嘉峪关市| 荣成市| 桦南县| 石城县| 吉木萨尔县| 湟源县| 奇台县| 安庆市| 叙永县| 若尔盖县| 德清县|