Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do people hate SQL cursors so much?
    text
    copied!<p>I can understand wanting to avoid having to use a cursor due to the overhead and inconvenience, but it looks like there's some serious cursor-phobia-mania going on where people are going to great lengths to avoid having to use one.</p> <p>For example, one question asked how to do something obviously trivial with a cursor and the accepted answer proposed using a common table expression (CTE) recursive query with a recursive custom function, even though this limits the number of rows that could be processed to 32 (due to recursive function call limit in sql server). This strikes me as a terrible solution for system longevity, not to mention a tremendous effort just to avoid using a simple cursor.</p> <p>What is the reason for this level of insane hatred? Has some 'noted authority' issued a fatwa against cursors? Does some unspeakable evil lurk in the heart of cursors that corrupts the morals of children or something?</p> <p>Wiki question, more interested in the answer than the rep.</p> <p>Related Info:</p> <p><a href="https://stackoverflow.com/questions/37029/sql-server-fast-forward-cursors">SQL Server Fast Forward Cursors</a></p> <p>EDIT: let me be more precise: I understand that <strong>cursors should not be used instead of normal relational operations</strong>; that is a no-brainer. What I don't understand is people going waaaaay out of their way to avoid cursors like they have cooties or something, even when a cursor is a simpler and/or more efficient solution. It's the irrational hatred that baffles me, not the obvious technical efficiencies.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload