一段实现分页的存储过程
一段实现分页的存储过程
Declare @PageSize int
一段实现分页的存储过程
set @PageSize=8
一段实现分页的存储过程
Declare @PageIndex int
一段实现分页的存储过程
set @PageIndex=1
一段实现分页的存储过程
--定义输出的参数
一段实现分页的存储过程
Declare @RecoundCount int
一段实现分页的存储过程
Declare @DateEof Bit  --output,--返回数据,是否溢出
一段实现分页的存储过程
Declare @PageCount int  --output--返回数据:总页数
一段实现分页的存储过程

一段实现分页的存储过程
Declare @TempResult varchar(1000)
一段实现分页的存储过程
Declare @OrderCommand varchar(1000)
一段实现分页的存储过程
Set @TempResult = 'Select * From dbo.Info_ProductInfo where Display=1 And Audting=0'
一段实现分页的存储过程
一段实现分页的存储过程
一段实现分页的存储过程
Declare @GetRCountSumStr nvarchar(1500)
一段实现分页的存储过程
Set @GetRCountSumStr = 'Select  @RecoundCount = Count(*) From (' + @TempResult + ') as t'
一段实现分页的存储过程
Exec sp_executesql @GetRCountSumStr,N'@RecoundCount int output',@RecoundCount output
一段实现分页的存储过程
一段实现分页的存储过程  
一段实现分页的存储过程  
一段实现分页的存储过程     
Declare @ResultMod int
一段实现分页的存储过程     
Set @ResultMod = @RecoundCount % @PageSize
一段实现分页的存储过程     
If @ResultMod = 0
一段实现分页的存储过程        
Set @PageCount = @RecoundCount / @PageSize
一段实现分页的存储过程      
Else
一段实现分页的存储过程        
Set @PageCount = (@RecoundCount / @PageSize+ 1
一段实现分页的存储过程     
Set @DateEof = 0
一段实现分页的存储过程     
If @PageIndex < 1
一段实现分页的存储过程        
Set @PageIndex = 1
一段实现分页的存储过程
一段实现分页的存储过程     
if @PageIndex > @PageCount
一段实现分页的存储过程        
Set @PageIndex = @PageCount
一段实现分页的存储过程
一段实现分页的存储过程     
Declare @GetProductAuditingList varchar(3000)
一段实现分页的存储过程     
Declare @indextable table(id int identity(1,1),PId int)
一段实现分页的存储过程     
一段实现分页的存储过程     
--'Insert Into @indextable(PId)' + @TempResult
一段实现分页的存储过程
     
一段实现分页的存储过程
一段实现分页的存储过程     
Set @GetProductAuditingList =('
一段实现分页的存储过程     Declare @indextable table(id int identity(1,1),SysId int)
一段实现分页的存储过程     Insert Into @indextable(SysId) Select SysId From (
' + @TempResult + ') as t 
一段实现分页的存储过程     Select P.*,u.UserName,C.CCnName,T.Id From @indextable as T,dbo.Info_UserInfo As u,Info_CompanyInfo as C,dbo.Info_ProductInfo as p Where Id > 
' + cast((@PageSize * @PageIndex- @PageSize as varchar(10)) + ' And Id <= ' + cast((@PageSize * @PageIndexas varchar(10)) + 
一段实现分页的存储过程     
'And P.SysId = T.SysId And p.UserId=u.SysId and P.CompanyId=C.SysID Order By T.Id')
一段实现分页的存储过程
一段实现分页的存储过程
一段实现分页的存储过程
一段实现分页的存储过程     
Exec(@GetProductAuditingList)
一段实现分页的存储过程  
一段实现分页的存储过程
一段实现分页的存储过程

相关文章: