declare BankStatment cursor for select ID from Person open BankStatement declare @id int fetch next from BankStatement into @id while (@@fetch_status =0) begin exec GetPersonBalance @id insert @results fetch next from BankStatement into @id end deallocate BankStatement