欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

SQLServer2005+分页SQL

程序员文章站 2022-04-10 20:33:14
...

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

SQLServer2005+分页SQL

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。