您的位置:首页 > 数据库

【SqlServer脚本系列-树形结构级联删除】

2013-03-30 13:35 176 查看
备注:Sqlserver树形结构级联删除、更新

with et as(select * from sys_dept where dept_id = 2
union ALL
select sys_dept.* from et, sys_dept where et.dept_id = sys_dept.parent_dept_id
)
delete from sys_dept where exists (select dept_id from sys_dept where et.dept_id = sys_dept.dept_id)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: