H
hwhl
Unregistered / Unconfirmed
GUEST, unregistred user!
while @@fetch_status>=0
begin
if exists (select * from sysobjects where name ='Rpt'+@Month
and xType='U' )
begin
Set @vs_QrySql='insert into #tRpt_Tmp(Org,SsTotal,ConCount)
select Org,sum(Total)as Total,sum(Times)as Times
from Rpt' + @vs_AccYearAndMonth+ ' E
where ' + @vs_where+
' group by Org'
exec(@vs_QrySql)
end
fetch chCurTmp into @Month
end
deallocate chCurTmp
谢谢大家咨询一下
动态用游标对照会计月后循环插入所建的临时表,如果所查数据跨月太大会很慢~~~这时应该如何优化呢请大家帮帮我谢谢
begin
if exists (select * from sysobjects where name ='Rpt'+@Month
and xType='U' )
begin
Set @vs_QrySql='insert into #tRpt_Tmp(Org,SsTotal,ConCount)
select Org,sum(Total)as Total,sum(Times)as Times
from Rpt' + @vs_AccYearAndMonth+ ' E
where ' + @vs_where+
' group by Org'
exec(@vs_QrySql)
end
fetch chCurTmp into @Month
end
deallocate chCurTmp
谢谢大家咨询一下
动态用游标对照会计月后循环插入所建的临时表,如果所查数据跨月太大会很慢~~~这时应该如何优化呢请大家帮帮我谢谢