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<=@pagenum*@pagesize;
相关文章
- SQLServer2005+分页SQL
- JAVA-Unit01: 数据库原理 、 SQL(DDL、DML)
- 牛客网 SQL1查询所有列
- Oracle SQL Developer中查看解释计划Explain Plan的两种方法
- 【SQL】语句练习
- SQL Server 2016新特性:DROP IF EXISTS
- SQL Server ->> SQL Server 2016新特性之 -- Dynamic Data Masking
- SQL Server ->> SQL Server 2016新特性之 --- Query Store
- SQL Server 2016新特性:Live Query Statistics
- Transact-SQL知识点梳理