Cursors (SQL Server Compact Edition)
Application developers usually use the relation (set)-based nature of SQL to manage data. However, sometimes application developers need the extra control of row-by-row operations. Cursors fulfill that need. In Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition), there are a number of different types of cursors that you can use to control row-by-row operations.
Most cursors can be used in conjunction with the query processor. There are a number of different cursor behaviors, such as scrollability, updatability, and sensitivity that also affect the choice of cursor. For more information, see "Cursor Behaviors" in SQL Server Books Online.
Some advantages of using cursors in conjunction with the query processor are:
Efficiency. The query optimizer automatically selects the appropriate query plan, so the developer does not need to design a complex algorithm to access the required data.
Adaptability. As data changes or indexes are added or dropped, the query optimizer automatically adapts its behavior by using alternative plans.
Fewer errors. Instead of the developer handling data and algorithms in the application, the SQL Server Compact Edition Database Engine natively supports the required operations.
Describes the cursor types supported by SQL Server Compact Edition.
Provides information to help you choose an appropriate cursor type.
Provides information about cursors and locking.
Lists factors that trigger SQL Server Compact Edition to implicitly convert a cursor from one type to another
Lists scenarios in which you might or might not be able to update results obtained through an updatable keyset-driven cursor.