Reputation: 15475
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?
Upvotes: 1
Views: 307
Reputation: 167
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.
Upvotes: -1
Reputation: 52808
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.
Upvotes: 3