在SQL Server 2008中删除外键声明错误 [英] DROP FOREIGN KEY STATEMENT ERROR IN SQL SERVER 2008
本文介绍了在SQL Server 2008中删除外键声明错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在SQL Server 2008中键入以下语句以删除外键.
I type the following statement in SQL server 2008 to drop a foreign key.
ALTER TABLE BOOK DROP FOREIGN KEY (FK_AUTHOR_NUMBER)
但是执行命令后,出现以下错误.
消息156,第15级,状态1,第1行
关键字"FOREIGN"附近的语法不正确.
请尝试解决我的疑问! Thanx
But after executing the command I got the following error.
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword ''FOREIGN''.
Please try to solve my doubt! Thanx
推荐答案
在查询中写CONSTRAINT名称
请参阅此链接
http://www.techonthenet.com/oracle/foreign_keys/drop.php [ ^ ]
Write the CONSTRAINT name in the query
Refer this link
http://www.techonthenet.com/oracle/foreign_keys/drop.php[^]
更改表t2删除约束[FK_t2_t2]
放置约束[constrint_name]
alter table t2 drop constraint [FK_t2_t2]
drop constraint [constrint_name]
这篇关于在SQL Server 2008中删除外键声明错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文