BUG: Invalid Syntax on SQLNumResultCols After Update Proc

ID: Q135311


The information in this article applies to:
  • Microsoft SQL Server version 4.2x

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

Keywords : kbprg SSrvProg SSrvTran_SQL kbbug4.21a
Version : 4.21 4.21a 1.02 2.5
Platform : WINDOWS
Issue type :


Last Reviewed: April 21, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.