Using Server Cursors
Collapse the table of content
Expand the table of content

Using Server Cursors


System_CAPS_ICON_warning.jpg Warning

SQL Server Native Client (SNAC) is not supported beyond SQL Server 2012. Avoid using SNAC in new development work, and plan to modify applications that currently use it. The Microsoft ODBC Driver for SQL Server provides native connectivity from Windows to Microsoft SQL Server and Microsoft Azure SQL Database.

If an ODBC application sets any of the ODBC cursor attributes to anything other than the defaults, the SQL Server Native Client ODBC driver requests the server to implement an API server cursor of the same type. Using API server cursors frees memory on the client and can significantly reduce network traffic between the client and server.

A potential drawback of API server cursors is that they currently do not support all SQL statements. API server cursors cannot be used to execute:

  • Batches or stored procedures that return multiple result sets.

  • SELECT statements that contain COMPUTE, COMPUTE BY, FOR BROWSE, or INTO clauses.

  • An EXECUTE statement referencing a remote stored procedure.

When connected to an instance of SQL Server, executing a statement with these characteristics using a server cursor causes the cursor being converted to a default result set. When connected to earlier versions of SQL Server, it causes an error.

How Cursors Are Implemented

Community Additions

© 2016 Microsoft