0

以下是我的存储过程

ALTER PROCEDURE [aaa].[sp_getabc] (                
      @fromdate smalldatetime,                
@todate smalldatetime)                


AS                
BEGIN                
SET NOCOUNT ON;                


declare @tmp1 as int  
declare @tmp2 as int  
declare @sum as int  
declare @tmp3 as int  
select @tmp1 = (select count(*) as decdbo from abc where AppID IN (108,104,113,110,218,171) and Status IN ('T','L') and calldate between  @fromdate and  @todate)  
select @tmp2 = (select count(*) as decauto from abc where AppID IN (278,283) and Status IN ('T','L') and calldate between  @fromdate and  @todate)  

select @sum = @tmp1 + @tmp2  

select @tmp3 = (select SUM(Duration)/60 as DecemberLastWeek from abc where dnis = '6503533019' and calldate between  @fromdate and  @todate)  

select @tmp3 as Duration , @sum as Transcriptions , @sum/@tmp3 as TransPerMin   


END

当我不作为存储过程执行语句时,我得到正确的值,而当我运行存储过程时,@tmp3 和 @sum/@tmp3 中没有任何 NULL,而 @sum 也有错误的值。问题出在哪里。谢谢你

4

2 回答 2

0

检查您的@fromdate@todate变量,两种情况它们必须不同(即格式)

于 2013-01-07T12:54:30.077 回答
0

解决的问题是我的存储过程在 autoivr 中,但我想访问的表在 dbo 中,我没有用表名写 dbo。

于 2013-01-08T08:43:24.523 回答