PRB: Syntax Error with Sp_dropkey on SQL Server 6.0

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


Keywords : kbusage SSrvDRI
Version : 6.0
Platform : WINDOWS
Issue type : kbprb


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