I am using a Cursor in my stored procedure. It works on a database that has a huge number of data. for every item in the cursor i do a update operation. This is taking a huge amount of time to complete. Almost 25min. 🙁 .. Is there anyway i can reduce the time consumed for this?
Share
When you need to do a more complex operation to each row than what a simple update would allow you, you can try:
Did you know about the UPDATE … FROM syntax? It is quite powerful when things get more complex:
The example is completely made-up and may not make much sense, but you get the picture of how to do a more complex update without having to use a cursor. Of course, a temp table would not necessarily be required for it to work. 🙂