关于Tree的操作
2008-10-02 21:11
183 查看
--递归删除父节点及所有子节点 create table tb(Id int, ParentId int, Name varchar(5)) insert into tb select 1, 0, 'a1' union all select 2,2, 'a2' union all select 14, 1, 'b11' union all select 15, 1, 'b12' union all select 16, 14, 'c13' union all select 17, 14, 'c14' union all select 104,17,'d15' go WITH temptab(id, parentid, name) AS ( SELECT root.id, root.parentid, root.name FROM tb root WHERE id=1 UNION ALL SELECT sub.id, sub.parentid, sub.name FROM tb sub, temptab super WHERE sub.parentid = super.id ) delete from tb where id in( select id from temptab ) select * from tb go drop table tb
相关文章推荐
- java中关于Tree的操作的小例子
- 关于tree的n种操作,很实用
- 关于 DevExpress.XtraTreeList.TreeList 树形控件 的操作
- 关于EasyUI-tree的一些操作
- c# winform 关于 datagridview 一些 操作
- Jquery easyui tree 一些常见操作
- c# 中关于对文件的简单操作
- linux中关于原子操作
- android 开发关于文件操作相关方法
- 关于oracle数据库的操作的命令
- 关于PHP实现异步操作的研究
- .net 关于listbox的常用操作
- mysql关于连接数的操作
- 关于C# 耗时操作的时间查看
- 关于重申快件出、入仓录单扫描、问题件处理等操作流程的通知
- 关于Java的Cookie操作
- Oracle关于时间/日期的操作
- 关于tomcat操作
- 关于点击某个按钮需要Edittext和软键盘一起弹出的操作和监听软键盘的关闭