PRB: Syntax Error with Sp_dropkey on SQL Server 6.0

Last reviewed: April 15, 1997
Article ID: Q156487
The information in this article applies to:
  • Microsoft SQL Server version 6.0

SYMPTOMS

When you attempt to run the stored procedure sp_dropkey on a computer running SQL Server 6.0 or later, you receive either of the following syntax errors:

  • Msg 156, Level 15, State 1 Incorrect syntax near the keyword 'primary'.

    -or-

  • Msg 156, Level 15, State 1 Incorrect syntax near the keyword 'foreign'.

CAUSE

With the introduction of Declarative Referential Integrity (DRI) in SQL Server 6.0, 'primary' and 'foreign' became keywords. Therefore, using either of them in sp_dropkey does not comply with their correct usage under SQL Server version 6.0 or later.

WORKAROUND

To work around this problem, enclose the keywords 'primary' or 'foreign' in quotes, as shown in the following examples:

  • sp_dropkey 'primary', table_name

    -or-

  • sp_dropkey 'foreign', table_name


Additional query words:
Keywords : kbusage SSrvDRI
Version : 6.0
Platform : WINDOWS
Issue type : kbprb


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