"Do something for each row of the query"
The only way I know is:
---
declare @C cursor
set @C= cursor for
select F from T where ...
declare @F int
open @C
while 0=0 begin
fetch next from @C into @F
if not(@@FETCH_STA TUS = 0) break
exec myStoredProc @F
end
close @C
deallocate @C
---
How to write it simpler, maybe with implicit cursors?
For example, in the Borland Interbase it would be like:
---
declare variable F integer;
for select F from T into :F
do execute procedure myStoredProc :F;
---
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
The only way I know is:
---
declare @C cursor
set @C= cursor for
select F from T where ...
declare @F int
open @C
while 0=0 begin
fetch next from @C into @F
if not(@@FETCH_STA TUS = 0) break
exec myStoredProc @F
end
close @C
deallocate @C
---
How to write it simpler, maybe with implicit cursors?
For example, in the Borland Interbase it would be like:
---
declare variable F integer;
for select F from T into :F
do execute procedure myStoredProc :F;
---
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Comment