以下是我的存储过程
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 也有错误的值。问题出在哪里。谢谢你