Assuming I have table with tasks called Tasks.
I want to delete selected tasks with stored procedure SP_Task_DEL (which deletes tasks).
This procedure have one parameter @Id (id of task to delete).
How to execute this stored procedure many times with all results of query:
select id from Tasks where status = 'completed'
?
You could use a cursor for that, like: