USE [Travel]
GO
/****** Object: StoredProcedure [dbo].[NoticeGetPagedData] Script Date: 06/13/2014 20:44:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[NoticeGetPagedData]
@pageIndex int = 1,--页码
@pageSize int =10,--页容量
@sMid int,
@rowCount float output,--输出 总行数
@pageCount float output--输出 总页数
AS
BEGIN
select @rowCount = COUNT(nId) from Notice where [email protected] --求总行数
set @pageCount= CEILING(@rowCount / @pageSize)--使用 天花板 函数,将 带小数的数值,加1 去小数
select * from(select row_number() over(order by nId) as rownum ,mn.*,n.ntName from(Notice as mn inner join NoticeType as n on mn.nMid=n.ntId and [email protected]))
as temp where temp.rownum >(@pageIndex-1)*@pageSize and temp.rownum <[email protected]*@pageSize
END
(Notice as mn inner join NoticeType as n on mn.nMid=n.ntId and [email protected] 应该再后面加上[email protected]再其他地方加入的话是错误的
数据库sql联合查询mid类型的分页数据取不了全部的值错误