mloskot
mloskot

Reputation: 38942

ODBC Driver 11 for SQL Server and SQLGetData limitations

The SQLGetData Function reference explains the following general limitation of the 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.

The ODBC API implementation details article on the SQLGetData adds information specific to the SQL Server Native Client driver:

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.

Does this column ordering limitation apply to the new and recommended Microsoft ODBC Driver for SQL Server?

Is there any difference in this behaviour between the current ODBC Driver 11 for SQL Server version and the upcoming version ODBC Driver 13 (Preview) for SQL Server?

Upvotes: 4

Views: 886

Answers (1)

Henrik Høyer
Henrik Høyer

Reputation: 1684

All current Microsoft SQL Server drivers has column ordering limitations.

You can test the drivers capabilities from code by calling the SQLGetInfo ODBC function.

ODBC Driver 17 for SQL Server returns the following:

SQL_GETDATA_EXTENSIONS:
        SQL_GD_ANY_COLUMN false
        SQL_GD_ANY_ORDER false

ODBC Driver 13 for SQL Server returns the following:

SQL_GETDATA_EXTENSIONS:
        SQL_GD_ANY_COLUMN false
        SQL_GD_ANY_ORDER false

SQL Server Native Client 10.0 returns the following:

SQL_GETDATA_EXTENSIONS:
        SQL_GD_ANY_COLUMN false
        SQL_GD_ANY_ORDER false

Upvotes: 3

Related Questions