Is it a good idea to use while loop instead of cursor. What are advantage/disadvantages of cursors.
views:
4645answers:
4
+1
A:
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)
ilitirit
2008-09-26 14:32:47
A:
Take a look at this discussion on triggers..
http://stackoverflow.com/questions/14031/database-triggers#15093
jinsungy
2008-09-26 14:34:46
A:
I would ask you what you are doing with that cursor/while loop.
If you are updating or returning data why don't you use a proper WHERE clause. I know people who would say you should never use cursors.
Nathan Koop
2008-09-26 14:36:51