Cursor verus while loop - what are the advantages/disadvantages of cursors?
database-cursor, sql-server, t-sql, while-loop
Solution
Some of these depends on the DBMS, but generally:
Pros:
Outperform loops when it comes to row-by-row processing
Works reasonably well with large datasets
Cons:
Don't scale as well
Use more server resources
Increases load on tempdb
Can cause leaks if used incorrectly (eg. Open without corresponding Close)
Problem
Is it a good idea to use while loop instead of a cursor? What are the advantages/disadvantages of cursors?