Feedback
Did this article resolve your question/issue?

   

Article

Error occurs when trying to fetch a 2nd result set from a stored procedure with the SQL Server Wire Protocol driver.

Information

 
TitleError occurs when trying to fetch a 2nd result set from a stored procedure with the SQL Server Wire Protocol driver.
URL NameMS-SQL-Server-returns-Number-of-bound-columns-exceeds-the-number-of-result-columns-in-a-stored-procedure-query
Article Number000176068
EnvironmentProduct: Connect for ODBC SQL Server Wire Protocol driver.
Version: 07.16.0294 (B0305, U0205)
OS: Linux
Database: SQL Server
Application: All supported applications
Question/Problem Description
Below error occurs when trying to fetch a 2nd result set from a stored procedure with the SQL Server Wire Protocol driver.
Steps to Reproduce
Clarifying Information
Error Message[DataDirect][ODBC SQL Server Wire Protocol driver]Number of bound columns exceeds the number of result columns.
Defect Number
Enhancement Number
Cause
The driver's current behavior is correct. 

Based on this specification:
Any bindings that were established for the previous result set still remain valid. If the column structures are different for this result set, then callingSQLFetch or SQLFetchScroll may result in an error or truncation. To prevent this, the application has to call SQLBindCol to explicitly rebind as appropriate (or do so by setting descriptor fields). Alternatively, the application can call SQLFreeStmt with an Option of SQL_UNBIND to unbind all the column buffers.

https://msdn.microsoft.com/en-us/library/ms714673%28v=vs.85%29.aspx
Resolution
This is expected behavior.
  • Call SQLFreeStmt with the option of SQL_UNBIND to unbind all the column buffers.
or
  •  Set connection option WorkArounds2=524288.
Workaround
Notes
Last Modified Date10/18/2016 6:35 AM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.