BUG: Invalid Syntax on SQLNumResultCols After Update Proc

Last reviewed: August 13, 1997
Article ID: Q135311

The information in this article applies to:
  • Microsoft SQL Server, version 4.21a
BUG# NT: 10985 (4.21a)

SYMPTOMS

The Microsoft Open Data Base Connectivity (ODBC) Open Data Services (ODS) Gateway driver which ships with SQL Server versions 4.21 and 4.21a gets an incorrect syntax error if SQLNumResultCols is called right after a SQLExecDirect of a procedure whose last step is an UPDATE, DELETE, or INSERT statement.

With a stored procedure of the following format:

   create procedure Insert_Num @key int, @value char(3) as
   insert into NumResults values (@key, @value)
   go

The procedure is correctly executed in Transact_SQL syntax by the ODBC ODS Gateway driver:

   SQLExecDirect(hstmt, "Insert_Num @key = 1, @value = 'aaa' ",SQL_NTS);

but a call to SQLNumResultCols immediately after the SQLExecDirect fails with the error:

   SqlState = 37000, pfNative = 170
   szErrorMsg = "Line 1: Incorrect syntax near 'Insert_Num' "

CAUSE

The error only occurs if the procedure is executed in Transact-SQL syntax, not if the procedure is executed in ODBC syntax.

WORKAROUND

SQLNumResultCols works correctly if the procedure is executed in ODBC syntax:

   SQLExecDirect(hstmt, "{ call Insert_Num (1, 'aaa')}", SQL_NTS);

STATUS

Microsoft has confirmed this to be a problem in the Microsoft ODBC ODS Driver version 1.02.3731. We are researching this problem, and will post new information here in the Microsoft Knowledge Base as it becomes available.

The problem does not occur in the Microsoft ODBC ODS Driver version 2.50.0121 that ships with SQL Server version 6.0


Additional query words:
Keywords : kbbug4.21a SSrvProg SSrvTran_SQL kbprg
Version : 4.21 4.21a 1.02 2.5
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 13, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.