麻烦高手帮我看看这个存储过程有什么问题,为什么运行时会出现资源不足
ALTER PROCEDURE dbo.UpdateAllBusinessDay @calday DateTime AS
DECLARE @businessno int, @businesscallinno varchar(32)
declare @usercountG int,@usercountC int
declare business_cursor Cursor for
select BusinessNo ,BusinessCallinNo from Business
open business_cursor
FETCH NEXT FROM business_cursor
INTO @businessno, @businesscallinno
WHILE @@FETCH_STATUS = 0
-----------------------------------
BEGIN
select distinct Caller from c_CallLog
where dbo.GetSimpDate(begintime)=dbo.GetSimpDate(@calday) and (Callee=@businesscallinno)
and (left(Caller,3)between 130 and 132)
GROUP by Caller
set @usercountG= @@rowcount
select @usercountG
select distinct Caller from c_CallLog where dbo.GetSimpDate(begintime)=dbo.GetSimpDate(@calday) and Callee=@businesscallinno
and (left(Caller,3)between 133 and 134)
set @usercountC= @@rowcount
select @usercountC
UPDATE BusinessDay
SET UsedCountG = @usercountG
FROM BusinessDay where CalDay=dbo.GetSimpDate(@calday) and BusinessNo=@businesscallinno
end
FETCH NEXT FROM business_cursor
INTO @businessno, @businesscallinno
-----------------------------------
--END
close business_cursor
Deallocate business_cursor