set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: 王再华
-- Create date: 2008.4.13
-- Description: 分页存储过程
-- =============================================
ALTER PROCEDURE [dbo].[Gbook_SP_GetBookPager]
@PageSize int, --每页显示数
@PageIndex int, --页索引
@Count int output --总页数
AS
BEGIN
select @Count=count(*) from book where id<10 -- 查询条件
select * from(
select *, ROW_NUMBER() OVER(order by id) as row from book where id<10 -- 查询条件
) a
where row between (@PageSize*(@PageIndex-1)+1) and @PageSize*@PageIndex
END