如何使用前键值删除主表记录中的行 [英] how to delete rows in main table records with foriegn key values

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

问题描述

您好,我要维护三个表
Maintable1,table2,table3
表是在设计时创建的,而不是通过查询执行创建的.
table2,table2是Maintable1下的外键表.

我的问题是在设计时创建表,因此如何在设计时从Maintable1中删除记录.

提供带有屏幕的示例或带有屏幕的示例站点

hello iam maintaing three tables
Maintable1,table2,table3
tables are created at desing time not by queries execute.
table2,table2 are the foreign key tables under Maintable1.

My question is tables created at desing time so how to delete a record from Maintable1 at design time.How to do this?

provide examples with screens or example site with screens

推荐答案

创建这些表时,请使用CASCADE Delete选项.
参见
http://msdn.microsoft.com/en-us/library/aa933119%28v = sql.80%29.aspx [ ^ ]
http://www.java2s.com/Code/SQLServer/Constraints/DELETECASCADEandUPDATECASCADE.htm [ ^ ]
When creating these table, use the CASCADE Delete option.
See
http://msdn.microsoft.com/en-us/library/aa933119%28v=sql.80%29.aspx[^]
http://www.java2s.com/Code/SQLServer/Constraints/DELETECASCADEandUPDATECASCADE.htm[^]


不确定设计时间是什么意思.

如果父记录是任何其他表中的外键,则不能删除该父记录.这就是按键应该起作用的方式.您需要先删除所有子记录,然后再删除父记录.
Not sure what you mean by design time.

You cannot delete the parent record if it is a foreign key in any other table. That is the way keys are supposed to work. You need to delete all the child records first and then the parent record.


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

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