Microsoft KB Archive/156487

{|
 * width="100%"|

PRB: Syntax Error with Sp_dropkey on SQL Server 6.0

 * }

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. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

"Q132949 INF: Support for Referential Integrity in SQL Server"

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

Issue type : kbprb

Technology : kbSQLServSearch kbAudDeveloper kbSQLServ600