這篇文章將為大家詳細(xì)講解有關(guān)sql server中怎么實(shí)現(xiàn)分頁(yè),文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。
具體如下:
declare @index int,@num intset @index = 1--當(dāng)前頁(yè)set @num = 2--單頁(yè)包含的行數(shù)--分頁(yè)1select top (@num) *from ppohdwhere doccode not in( select top (@num * (@index -1)) doccode from ppohd order by doccode)order by doccode--分頁(yè)2select top (@num) *from ppohdwhere doccode >=( select max(doccode) from ( select top (@num * (@index - 1) + 1) doccode from ppohd order by doccode ) as tb)--分頁(yè)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--分頁(yè)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)
關(guān)于sql server中怎么實(shí)現(xiàn)分頁(yè)就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。
網(wǎng)頁(yè)標(biāo)題:sqlserver中怎么實(shí)現(xiàn)分頁(yè)-創(chuàng)新互聯(lián)
URL分享:http://www.rwnh.cn/article36/dggcpg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、網(wǎng)站維護(hù)、動(dòng)態(tài)網(wǎng)站、微信公眾號(hào)、建站公司、云服務(wù)器
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容