Home  >  Article  >  Database  >  SQLServer2005+分页SQL

SQLServer2005+分页SQL

WBOY
WBOYOriginal
2016-06-07 17:40:361200browse

declare @pagenum int = 1;declare @pagesize int = 3;WITH Tmp AS (SELECTROW_NUMBER() OVER (ORDER BY uid ASC) AS colnum,uid,unameFROM dbo.users o1)SELECT uid,uname FROM TmpWHERE colnum(@pagenum-1)*@pagesize AND colnum=@pagenum*@pagesize;

declare @pagenum int = 1; declare @pagesize int = 3; WITH Tmp AS ( SELECT ROW_NUMBER() OVER (ORDER BY uid ASC) AS colnum, uid, uname FROM dbo.users o1 ) SELECT uid,uname FROM Tmp WHERE colnum>(@pagenum-1)*@pagesize AND colnum

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn