Is it possible to 开发者_如何学运维run a stored procedure for each record against a resultset?
For example,
Select * from Customers
for each record in the results above execute my stored procedure.
And also (not really important if not possible), have all this inside a main stored procedure?
You might be better using a User Defined Function if you are not inserting / updating. Otherwise a cursor or a while loop to iterate through each row. This will probably lead to poor performing code, and/or not be optimised by SQL very well.
Being that cursors are inefficient, it would probably be a better idea to return your results from the Select * from customers query to your code base and loop through the results in your code to call the other procedure.
精彩评论