日期:2014-05-20  浏览次数:20366 次

一个存储过程问题
ALTER   PROCEDURE   [dbo].[a_Example]
@startIndex   INT,  
@pageSize   INT  
AS
begin
select   count(InOutBedID)   as   RecordCountID   from   InOut_InOut_InOutBed
end
begin
WITH   orderList   AS  
(  
SELECT   *,row_number()   OVER   (ORDER   BY   InOutBedID   DESC)AS   Row
from   InOut_InOut_InOutBed
)
SELECT   *
FROM   orderlist  
WHERE   row   between   @startIndex   and   @startIndex+@pageSize-1
end

这个存储过程
select   count(InOutBedID)   as   RecordCountID   from   InOut_InOut_InOutBed
是统计个数
下面的是分页
返回的是2个表
怎么把统计的个数也存到orderList视图中
然后返回结果是一个表?

------解决方案--------------------
统计的个数你可以用输出参数或者返回值


------解决方案--------------------
存储过程加个参数 @count output 最后 select @count = count(InOutBedID) as RecordCountID from InOut_InOut_InOutBed
------解决方案--------------------
用output型参数输入单个值.
------解决方案--------------------
同意楼上的
把一个作为输出参数