BUG: SQLState 07006 if Procedure Returns an Output Parameter

ID: Q152173


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


SYMPTOMS

If a stored procedure contains an output parameter and either PRINT or RAISERROR statements, the Microsoft SQL Server ODBC Driver may incorrectly return the following SQLState:

SQLState = 07006, pfNative = 0
szErrorMsg = '[Microsoft][ODBC SQL Server Driver]
Restricted data type attribute violation.'


MORE INFORMATION

The ODBC driver raises the 07006 SQLState when it should be returning the output parameter, usually on the SQLFetch() or SQLExtendedFetch() for the final row of the last result set from the procedure. The output parameter value is not returned to the application. If the PRINT or RAISERROR is commented out, the driver will return the output parameter value at the correct time. The condition will not occur if there is only one PRINT statement and it is the first statement executed in the procedure. If there are multiple PRINT's, or it is not the first statement in the batch, the 07006 may be returned.


STATUS

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


WORKAROUND

Return the output parameter as a regular select result set rather than an output parameter if the procedure contains either PRINT or RAISERROR statements.

Additional query words: SQLExecDirect SQLExecute

Keywords : kbbug6.00
Version : 6.0
Platform : WINDOWS
Issue type :


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