Due to size of data (not to blow spool space) I need to chop that big dataset with cursor looping through X millions of rows.
Our database is really busy, and each iteration of loop gets parsed individually. This results in stored procedure executing hours, simply due to sql statement executed in loop getting queued with each time loop iterates.
Is there any way of executing stored procedure in the way that it would avoid queuing looped sql statement ?
Sounds silly, but I am desparate.
Will the below link of this gentleman help you? It is self-explanatory.