Throughout the book, I try to stress the advantages set-based solutions have over cursor-based ones. I show many examples of tuned set-based solutions that outperform the cursor alternatives. In this chapter, I explained why that’s the case for most types of problems. Nevertheless, I tried giving you the tools to identify the classes of problems that are exceptions–where currently SQL Server 2005 doesn’t provide a better solution than using cursors. Some of the problems would have better set-based answers if SQL Server implemented additional ANSI constructs, whereas others don’t even have proper answers in the ANSI standard yet. The point is that there’s a time and place for cursors if they are used wisely and if a set-based means of solving the problem cannot be found.
3.133.150.142