Skip to content

Latest commit

 

History

History
29 lines (24 loc) · 1.89 KB

File metadata and controls

29 lines (24 loc) · 1.89 KB
title Using Autofetch with ODBC Cursors | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.prod_service database-engine, sql-database, sql-data-warehouse, pdw
ms.reviewer
ms.technology native-client
ms.topic reference
helpviewer_keywords
ODBC cursors, autofetch
autofetch option
cursors [ODBC], autofetch
ms.assetid 57bd55f4-8945-4d8d-9f58-d30c81d2a514
author markingmyname
ms.author maghan
monikerRange >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current

Using Autofetch with ODBC Cursors

[!INCLUDEappliesto-ss-asdb-asdw-pdw-md]

When connected to an instance of [!INCLUDEssNoVersion], the [!INCLUDEssNoVersion] Native Client 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.

See Also

Cursor Programming Details (ODBC)