mwitthoft (1/12/2014)
Good ideas about the cursor declaration. Yes, it's declared LOCAL. And although the proc does not modify the table that the cursor is reading, I'm planning to try a superfluous STATIC declaration when I get back in the office, just to see if that flushes the problem.I'm curious how you recode this logic to a set-based approach:
Cursor thru InputTable
Fetch next into @MyVar
while MoreData
Exec API_proc @MyVar
Fetch next into @MyVar
wend
Of course I can build my own cursor:
Instead of.....Declare Cursor for Select xyz............. I can say.....Select Xyz into #Temp..........
Then instead of .........Fetch/Process/FetchNext.......... I can say ....... select top 1 from #Temp/process/Delete (that row) from #Temp/Select Top1 from #Temp
which is technically set-based but probably not what you meant.
Give me a little time and I will show you. Unfortunately I have other things I need to do right now. I should have some time later tonight to throw something together.