TechNet
Export (0) Print
Expand All

SQLNumResultCols

 

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.

For executed statements, the SQL Server Native Client ODBC driver does not visit the server to report the number of columns in a result set. In this case, SQLNumResultCols does not cause a server roundtrip. Like SQLDescribeCol and SQLColAttribute, calling SQLNumResultCols on prepared but not executed statements generates a server roundtrip.

When a Transact-SQL statement or statement batch returns multiple result row sets, it is possible for the number of result set columns to change from one set to another. SQLNumResultCols should be called for each set. When the number of columns changes, the application should rebind data values prior to fetching row results. For more information about handling multiple result set returns, see SQLMoreResults.

Improvements in the database engine starting with SQL Server 2012 allow SQLNumResultCols to obtain more accurate descriptions of the expected results. These more accurate results may differ from the values returned by SQLNumResultCols in previous versions of SQL Server. For more information, see Metadata Discovery.

SQLNumResultCols Function
ODBC API Implementation Details

Community Additions

ADD
Show:
© 2016 Microsoft