How can I iterate over a recordset within a stored procedure?
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-04-12T13:06:34Z
Indexed on
2010/04/12
13:13 UTC
Read the original article
Hit count: 292
I need to iterate over a recordset from a stored procedure and execute another stored procedure using each fields as arguments. I can't complete this iteration in the code. I have found samples on the internets, but they all seem to deal with a counter. I'm not sure if my problem involved a counter. I need the T-SQL equivalent of a foreach
Currently, my first stored procedure stores its recordset in a temp table, #mytemp. I assume I will call the secondary stored procedure like this:
while (something)
execute nameofstoredprocedure arg1, arg2, arg3
end
© Stack Overflow or respective owner