Recap

Cursors are not the recommended way to solve most data access or update problems, and they can cause serious performance headaches when used improperly. Your first thought (before using Transact-SQL) when contemplating how to solve a problem you have seen should be to align your code with the way SQL Server was designed to work—that is, to access data in sets if at all possible. Resort to using cursors only after you've explored as many set-based alternatives as possible.

Get Guru's Guide to SQL Server Architecture and Internals, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.