Sql Server 存储过程分页
2015-11-15 11:01
393 查看
create proc usp_GetMyPhotos @pageIndex int, --当前页码 @pageSize int, --每页多少条 @pageCount int output --计算 总共多少页 as declare @count int --总共多少条 select @count =COUNT(*) from room set @pageCount = CEILING( @count*1.0/@pageSize) select * from (select *,ROW_NUMBER() over(order by ids desc) as num from room) as t where num between @pageSize*(@pageIndex-1) + 1 and @pageSize*@pageIndex declare @n int exec usp_GetMyPhotos 4,3,@n output print @n
相关文章推荐
- Redis持久化
- JDBC连接MySQL 插入中文数据的乱码问题
- MySQL 全文索引基础操作
- CentOS6.x安装memcaches1.4.x
- MySQL入门
- 使用mysql时遇到的各种问题
- mysql使用笔记:相关术语和定义
- mysql子查询
- oracle 存储过程学习地址
- Android数据库 contentprovider
- mysqldump:Couldn't execute 'show create table `tablename`': Table tablename' doesn't exist (1146)
- 75.Oracle数据库SQL开发之 高级查询——更新已有的单元
- 74.Oracle数据库SQL开发之 高级查询——处理空值和缺失值
- 73.Oracle数据库SQL开发之 高级查询——用FOR循环访问数据单元
- 72.Oracle数据库SQL开发之 高级查询——用CURRENTV获取某个维度的当前值
- 71.Oracle数据库SQL开发之 高级查询——用ANY和IS ANY访问所有的数据单元
- 70.Oracle数据库SQL开发之 高级查询——用BWTWEEN和AND返回特定范围
- 69.Oracle数据库SQL开发之 高级查询——用位置标记和符号标记访问数据单元
- 68.Oracle数据库SQL开发之 高级查询——使用MODEL子句
- 67.Oracle数据库SQL开发之 高级查询——使用假想评级与分布函数