删除外键常量并更新表 [英] Drop foreign key constratint and update the table

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

问题描述

大家好,我想更新一个名为employee的表,但是由于在外键构造中还有其他与之相关的表,我遇到了异常.
我该如何更新表格,谁能帮我.
如何删除外键约束,然后更新表,然后再次放置约束.

Thanks

Hello everyone, I want to update a table named employee but I am getting an exception as there some other tables associated with it in a foreign key constratint.
How can i update the table, can anyone help me.
How can i drop foreign key constraint and then update the table and then again put the constraint.

thanks

推荐答案

不,您不应该删除外键.
相反,请查看CASCADE 选项 [ ^ ] .
更改您的表结构以使用它.
No you should not be dropping the foreign key.
Instead have a look at the CASCADE option[^].
Alter your table structure to use it.


考虑了Abhinav的建议-但是,如果您继续这样做,应该这样做:

Give thought to Abhinav''s advice - but if you go ahead this should do it:

ALTER TABLE tbl_name DROP FOREIGN KEY fk_symbol;



这是我使用的实际示例:



Here''s an actual example that I have used:

ALTER TABLE VendaTic.RoleMaster DROP FOREIGN KEY Feature_Code;


您好,亲爱的,

无论您要问什么,这都是不可能的.根据您的说法,employee表通过外键与另一个表关联.如果您不希望其他表重新登录,请执行以下步骤

1.右键单击雇员表,然后选择修改.然后,表将打开,并带有其列和数据类型.选择作为外键的列.
2.右键单击该列并选择关系.
3.将打开一个窗口,您可以在其中选择 插入并更新规范 ,然后选择更新规则,然后选择无操作从下拉列表中.
4.现在,您的表将允许您进行更新.

希望这会帮助你.如果没有,则再次查询.
Hello Dear,

What ever you are asking that is not possible. According to you the employee table is associated with another table by a foreign key. If you don''t want another table reocord then do the following steps

1. right Click on the employee table and select modify. Then table will open with its column and datatypes. selct the column which is the foreign key.
2.Right click on that column and select relaionship.
3.One window will open where you select insert and update specification and selct the update rule then select no action from the dropdown.
4. Now your table will allow you to update.

Hope this will help you. If not then query again.


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

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