How to convert CURSOR based query in to SET based
问题 I'm not a expert on SQL and I'm working on a huge SQL code and unfortunately it has a CURSOR which handles another two nested CURSORS within it (totally three cursors inside a stored procedure), which handles millions of data to be DELETE,UPDATE and INSERT. This takes a whole lot of time (more than 13 hrs and eventually gets an error 'cursor names datasets already exists') because of row by row execution and I'm trying to modify this in to SET based approach and I'm stuck how to do the INSERT