Is it better to use cursors or looping througb Temp tables is a better choice?
It all depends on your situation, both options are not preferable in terms of performance.
Cursors are more preferable when you need to perform multiple operations one by one on each row of your physical table. So, only one row at a time would be in memory.
However, Temp Tables have your complete table data in memory, also you need to maintain additional variable for looping index purpose.
This is just a little comparison, Can you describe your situation in details ??
They both exist because both are useful at times. It depends on the situation. I would say that creating a temp table you can join against is often more efficient, but both are expensive options
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)