declare @field1 varchar(1000)
declare @field2 varchar(1000)
CREATE TABLE #tempTable(FormulaType Varchar(100),co Varchar(5), Amount float)
declare cur CURSOR LOCAL for
--select field1, field2 from sometable where someotherfield is null
select top 10 CustomList_Name,CustomList_Item from mfdb.dbo.tblMF_Custom
open cur
fetch next from cur into @field1, @field2
while @@FETCH_STATUS = 0 BEGIN
--execute your sproc on each row
insert into #tempTable(FormulaType,co,Amount)
execute SP_testfunc @field1,@field2
--print @field1
fetch next from cur into @field1, @field2
END
close cur
deallocate cur
select * from #tempTable
No comments:
Post a Comment