您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關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中怎么實現分頁就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。