开发者

run stored proc over resultset

开发者 https://www.devze.com 2023-02-10 04:59 出处:网络
Is it possible to 开发者_如何学运维run a stored procedure for each record against a resultset?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消