编辑分页的存储过程
来源:互联网 发布:物联网技术 java 编辑:程序博客网 时间:2024/05/20 13:05
USE [BookSales]
GO
/****** 对象: StoredProcedure [dbo].[sp_book_Select_by_Page_rowNumber] 脚本日期: 11/25/2011 21:46:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_book_Select_by_Page_rowNumber]
-- Add the parameters for the stored procedure here
--<@Param1, sysname, @p1> <Datatype_For_Param1, , int> = <Default_Value_For_Param1, , 0>,
--<@Param2, sysname, @p2> <Datatype_For_Param2, , int> = <Default_Value_For_Param2, , 0>
@pageSize int, --每页记录数量
@pageCount int output, --总页数
@pageIndex int --当前页索引号
AS
BEGIN
declare @totalRecords int
select @totalRecords = count(BID) from Book
if(@totalRecords % @pageSize = 0)
set @pageCount = @totalRecords / @pageSize;
else
set @pageCount = @totalRecords / @pageSize +1;
with temp as (select row_number() over (order by BID) as id,* from Book)
select * from temp where id between (@pageIndex -1)*@pageSize +1 and @pageIndex * @pageSize
return @totalRecords
end
GO
/****** 对象: StoredProcedure [dbo].[sp_book_Select_by_Page_rowNumber] 脚本日期: 11/25/2011 21:46:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_book_Select_by_Page_rowNumber]
-- Add the parameters for the stored procedure here
--<@Param1, sysname, @p1> <Datatype_For_Param1, , int> = <Default_Value_For_Param1, , 0>,
--<@Param2, sysname, @p2> <Datatype_For_Param2, , int> = <Default_Value_For_Param2, , 0>
@pageSize int, --每页记录数量
@pageCount int output, --总页数
@pageIndex int --当前页索引号
AS
BEGIN
declare @totalRecords int
select @totalRecords = count(BID) from Book
if(@totalRecords % @pageSize = 0)
set @pageCount = @totalRecords / @pageSize;
else
set @pageCount = @totalRecords / @pageSize +1;
with temp as (select row_number() over (order by BID) as id,* from Book)
select * from temp where id between (@pageIndex -1)*@pageSize +1 and @pageIndex * @pageSize
return @totalRecords
end
- 编辑分页的存储过程
- ASPNET:DataGrid+存储过程的分页编辑代码[原创]
- ASPNET:DataGrid+存储过程的分页编辑代码
- ASPNET:DataGrid+存储过程的分页编辑代码
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 存储过程的分页!!
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- 分页的存储过程
- vocabulary
- 【動態規劃】多多看DVD(加強版)
- 在工具条上创建ComboBox控件
- Android数据库内容变化的监听
- QT----1----全功能计算器(支持键盘操作)
- 编辑分页的存储过程
- oracle 查看隐藏参数
- 老外写的SQLite3封装类
- vxworks鼠标键盘重启问题
- 世上只有知识不存在再分配
- Android数据库内容变化的监听(附件1)
- 函数重载有感
- Win7 "不支持此接口"问题
- 配置新的product(译)——android编译系统