Why is it considered bad practice to use cursors in SQL Server? -


i knew of performance reasons in sql 7 days, same issues still exist in sql server 2005? if have resultset in stored procedure want act upon individually, cursors still bad choice? if so, why?

because cursors take memory , create locks.

what doing attempting force set-based technology non-set based functionality. and, in fairness, should point out cursors do have use, frowned upon because many folks not used using set-based solutions use cursors instead of figuring out set-based solution.

but, when open cursor, loading rows memory , locking them, creating potential blocks. then, cycle through cursor, making changes other tables , still keeping of memory , locks of cursor open.

all of has potential cause performance issues other users.

so, general rule, cursors frowned upon. if that's first solution arrived @ in solving problem.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -