Mat*_*att 0 sql sql-server cascading-deletes sql-delete
假设我在表中有一行AI希望删除但在其他表中有多个外键约束.有没有办法自动生成删除命令?我认为一个工具可以递归地查看外键,然后生成一个删除语句来处理所有外键应该存在,但我找不到一个.
我在MSSql server2008上
设置外键关系时,ON DELETE CASCADE可以添加.
ON DELETE CASCADE
Specifies that if an attempt is made to delete a row with a key referenced by foreign
keys in existing rows in other tables, all rows containing those foreign keys are also
deleted. If cascading referential actions have also been defined on the target tables,
the specified cascading actions are also taken for the rows deleted from those tables.
Run Code Online (Sandbox Code Playgroud)
所以甚至有一个解决方案,你不将它添加到表:
在SQL Server 2005中,我可以在不设置表格属性的情况下进行级联删除吗?
| 归档时间: |
|
| 查看次数: |
671 次 |
| 最近记录: |