Microsoft KB Archive/124899

= BUG: SQLNumResultCols May Fail After Prepared SQL Statement =

Article ID: 124899

Article Last Modified on 7/27/2001

-

APPLIES TO


 * Microsoft Open Database Connectivity 1.0
 * Microsoft Open Database Connectivity 2.0

-



This article was previously published under Q124899



BUG# AddonBugs: 10888 (1.02.3231)



SYMPTOMS
After preparing a SELECT statement, a call to an ODBC meta data function call, such as SQLDescribeCol, SQLNumResultCols, and SQLColAttributes, fails with the message:

Syntax error near 'where'

This happens only if the above functions are called after SQLPrepare has been called but before SQLExecute has been called. The following code demonstrates the problem: SQLPrepare(hstmt, "select sum(qty) from sales group by stor_id") SQLNumResultCols(hstmt, &col) ==> SQL_ERROR SQLError ==> "Syntax error near 'where'"



CAUSE
The SQL Server driver is sending an improperly constructed SQL statement to SQL Server at the time SQLNumResultCols, SQLDescribeCol, and SQLColAttributes are called.



WORKAROUND
Because this problem appears only if SQLExecute has not been called, it is recommended that meta data function calls be called after both SQLPrepare and SQLExecute have been called.



STATUS
Microsoft has confirmed this to be a problem in the 16-bit Microsoft SQL Server driver version 1.02.3231 and 32-bit SQL Server driver version 2.00.1912. We are researching this problem and will post more information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: 1.02.3231 2.00.1912 Windows NT

Keywords: kbbug KB124899

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.