BUG: Stored Procedure May Fail with Error 264

Last reviewed: April 10, 1997
Article ID: Q163375
The information in this article applies to:
  • Microsoft SQL Server, versions 6.0 and 6.5
BUG #: 16542 (6.50)

SYMPTOMS

When you run a stored procedure with two parameters that performs an update, you may receive the following error message if the datatype of the first field in the target table is defined as smallint:

   Msg 264, Level 16, State 1
   Column name  appears more than once in the result column list.

This error message occurs only if all the following conditions are true:
  • The first field's datatype of the insertion target table is defined as smallint.
  • The stored procedure takes only two parameters.
  • Those two input parameters are in the particular order as in the following demonstration scenario:

          CREATE TABLE NextIDs
          (
    
             SmallIntID smallint,
             NextID int
          )
          GO
    
          INSERT NextIDs values (0, 0)
          GO
    
          DROP PROCEDURE sp_GetNextID
          GO
    
          CREATE PROCEDURE sp_GetNextID
             (@IDName varchar(15),
             @NextID int OUTPUT)
          AS
             UPDATE NextIDs SET NextID = NextID + 1, @NextID = NextID
          GO
    
          DECLARE @NextID int
          EXEC sp_GetNextID 'TEST', @NextID OUTPUT
          SELECT @NextID
    
    

WORKAROUND

To work around this problem, do any of the following:

  • Swap the two input parameters of the stored procedure in the creation and calling of scripts.
  • Redefine the table so that the first field's datatype is not smallint.
  • Redefine the stored procedure so that it takes more or fewer parameters.

STATUS

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


Additional query words:
Keywords : kbbug6.00 kbbug6.50 kbusage SSrvStProc
Version : 6.0 6.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: April 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.