Posted by Simon Hayes on 09/21/05 18:09
You can do this using a cursor - executing a stored proc repeatedly for
each value in a column is one of the (few) cases where they're useful.
In performance terms it would probably be better to rewrite proc1,
proc2 etc. to operate on a set of values using set-based code (but that
may not be possible, of course, depending on what the procs are doing).
declare @StoreGroupe int
declare cur cursor local static
for select SomeCode from dbo.StoreGroupes
open cur
fetch next from cur into @StoreGroupe
while @@fetch_status = 0
begin
exec dbo.proc1 @StoreGroupe
exec dbo.proc2 @StoreGroupe
-- etc.
fetch next from cur into @StoreGroupe
end
close cur
deallocate cur
Simon
Navigation:
[Reply to this message]
|