Using Autofetch with ODBC Cursors

ODBC and SQL Server

ODBC and SQL Server

Using Autofetch with ODBC Cursors

When connected to an instance of Microsoft® SQL Server™ 2000 , the SQL Server ODBC driver supports an autofetch option when using any server cursor type. With autofetch, the SQLExecute or SQLExecDirect function that opens the cursor also has an implicit SQLFetchScroll(SQL_FIRST) function. The rows comprising the first rowset are returned to the bound application variables as part of the statement execution, saving another roundtrip across the network to the server. SQLGetData is not supported when the autofetch option is enabled; the result set columns must be bound to program variables.

Applications request autofetch by setting the driver-specific SQL_SOPT_SS_CURSOR_OPTIONS statement attribute to SQL_CO_AF.