如何删除主键表已删除的外键 [英] How to delete a foreign key whose primary key's table already deleted

查看:289
本文介绍了如何删除主键表已删除的外键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨2全部,



我有问题。我的桌子上有一把外键。但是已经删除了将该外键作为主键相关的另一个表。现在我想删除这个外键..但没有任何反应...

我怎么能删除这个键..请告诉我frnds ....



详细说明



我的表名是centerinfo

,此表上的外键是FK__TargetInf__Cente__0777106D



与主要 - 外国关键关系相关的表是targetinfoold



和此表( targetinfoold)已经删除...



现在如何删除这个外键

解决方案

ALTER TABLE centerinfo DROP FOREIGN KEYFK__TargetInf__Cente__0777106D使用此查询。我认为这是正确的,所以只是尝试但不是100%。


哦,你有很多资源检查这个



http://stackoverflow.com/questions/3815674/delete-from-two- table-having-foreign-key-constraint [ ^ ]



http://en.wikipedia.org/wiki/Foreign_key [ ^ ]





http://www.w3schools.com/sql/sql_foreignkey.asp [ ^ ]





http://msdn.microsoft.com/en-us/library/ds1swzd3.aspx [ ^ ]



问候..:)

hi 2 all ,

I have a problem . i have a foreign key on my table . but the other table which related t this foreign key as a primary key has been deleted already . now i want to remove this foreign key .. but nothing happen ...
how can i delete this key .. pls tell me frnds ....

in detail

my table name is centerinfo
and foreign key on this table is "FK__TargetInf__Cente__0777106D"

and the table which related to this with primary -foreign key relation is "targetinfoold"

and this table(targetinfoold) already deleted ...

how to delete this foreign key now
?

解决方案

ALTER TABLE centerinfo DROP FOREIGN KEY "FK__TargetInf__Cente__0777106D" use this query . i think it is correct so just try but not in 100%.


oh you have lots resources check this

http://stackoverflow.com/questions/3815674/delete-from-two-table-having-foreign-key-constraint[^]

http://en.wikipedia.org/wiki/Foreign_key[^]


http://www.w3schools.com/sql/sql_foreignkey.asp[^]


http://msdn.microsoft.com/en-us/library/ds1swzd3.aspx[^]

regards..:)


这篇关于如何删除主键表已删除的外键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆