博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sql语句的分页技术
阅读量:7035 次
发布时间:2019-06-28

本文共 760 字,大约阅读时间需要 2 分钟。

hot3.png

alter proc T_categories(	@pageIndex int ,	@pageCount int )asbeginselect top (@pageCount) CategoryName	from Categories	 where Categories.CategoryName not in		(select top ((@pageIndex-1)*@pageCount) CategoryName from Categories order by Categories.CategoryID) order by Categories.CategoryIDendexec T_categories 2,2select CategoryName from Categories order by CategoryID

这是rowNumber的分页技术

alter proc T_RowNumber(	@pageSize int,	@pageIndex int)as begin	with t_RowNumber 	as	(		select ROW_NUMBER() over(order by Products.ProductID) as RowNum , * from Products	)		select * from t_RowNumber where RowNum >= ((@pageIndex-1) * @pageSize +1) and RowNum <= ( @pageIndex * @pageSize) order by ProductIDendexec T_RowNumber 5, 2

转载于:https://my.oschina.net/u/586106/blog/72808

你可能感兴趣的文章
自动问答技术简介
查看>>
用MyEclipse写jsp文件时,出现光标不见了或者乱跑的情况
查看>>
SiteFactoryCMS还原
查看>>
携程Apollo一键编译脚本+部署实现
查看>>
我的友情链接
查看>>
linux下ftp的安全巧用之pureftp!
查看>>
初始化AppWidget框架结构
查看>>
[PHP] 文件系统交互
查看>>
技术架构两三语
查看>>
我的友情链接
查看>>
文本处理“三剑客”之SED"
查看>>
find应用示例
查看>>
Kmail身份验证组件
查看>>
为什么很多招聘信息都要求三年以上的工作经验?
查看>>
拷贝构造函数为何传入引用?
查看>>
at命令及服务
查看>>
sqlserver无法在数据库上放置锁
查看>>
完全背包问题
查看>>
resin app server安装总结
查看>>
订单信息表和订单明细表
查看>>