求解读一段存储过程,望能详细描述语句的作用!
CREATE PROCEDURE spARPU
@counts int ,
@make int
AS
declare @TimeID varchar(8)
declare @UserID varchar(20)
declare @CustomSubTypeID varchar(20)
declare @SubTypeID varchar(40)
declare @ARPURevenue decimal(10,2)
declare @AddARPURevenue decimal(10,2)
declare @k int
set @k=1
declare ts CURSOR scroll dynamic FOR
select TimeID from tTime
declare sname1 CURSOR scroll dynamic FOR
select SiteID from TArea
declare uname1 CURSOR scroll dynamic FOR
select UserID from tUsers
declare csname CURSOR scroll dynamic FOR
select CustomSubTypeID from tCustomType
declare cs1 CURSOR scroll dynamic FOR
select Counts from tCallCounts
declare sertypename1 cursor scroll dynamic for
select SubTypeID from tServSubType
declare hs1 CURSOR scroll dynamic FOR
select Hours from tPeriodHour
declare servname cursor scroll dynamic for
select CallTypeID from tCallType
declare billname cursor scroll dynamic for
select BillingCycleTypeID from tBillingCycleType
declare workname cursor scroll dynamic for
select WorkingTypeName from tWorkingType
open uname1
open csname
open cs1
open sertypename1
open ts
open hs1
open servname
open workname
while @k <=@counts
begin
FETCH NEXT FROM ts into @TimeID
if @@FETCH_STATUS <> 0