BUG: SQLState 07006 if Procedure Returns an Output Parameter

Last reviewed: May 5, 1997
Article 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


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: May 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.