SQL 服务器和 SQLGetData 限制的 ODBC 驱动程序 11

ODBC Driver 11 for SQL Server and SQLGetData limitations

SQLGetData Function 参考解释了 API 的以下一般限制:

If the driver does not support extensions to SQLGetData, the function can return data only for unbound columns with a number greater than that of the last bound column. Furthermore, within a row of data, the value of the Col_or_Param_Num argument in each call to SQLGetData must be greater than or equal to the value of Col_or_Param_Num in the previous call; that is, data must be retrieved in increasing column number order.

SQLGetData 上的 ODBC API implementation details article 添加了特定于 SQL Server Native Client 驱动程序的信息:

The SQL Server Native Client ODBC driver does not support using SQLGetData to retrieve data in random column order. All unbound columns processed with SQLGetData must have higher column ordinals than the bound columns in the result set.

此列顺序限制是否适用于新的和推荐的 Microsoft ODBC Driver for SQL Server

当前版本与此行为之间有什么不同吗? SQL 服务器版本的 ODBC 驱动程序 11 和 SQL 服务器版本的 ODBC 驱动程序 13(预览版)?

所有当前的 Microsoft SQL 服务器驱动程序都有列顺序限制。

您可以通过调用 SQLGetInfo ODBC 函数从代码测试驱动程序功能。

ODBC 驱动程序 17 用于 SQL 服务器 returns 以下:

SQL_GETDATA_EXTENSIONS:
        SQL_GD_ANY_COLUMN false
        SQL_GD_ANY_ORDER false

ODBC 驱动程序 13 用于 SQL 服务器 returns 以下:

SQL_GETDATA_EXTENSIONS:
        SQL_GD_ANY_COLUMN false
        SQL_GD_ANY_ORDER false

SQL Server Native Client 10.0 returns 如下:

SQL_GETDATA_EXTENSIONS:
        SQL_GD_ANY_COLUMN false
        SQL_GD_ANY_ORDER false