大智

快乐工作中生活

 

2012年11月1日

SQL Server 自定义函数 返回树结构函数

摘要: 数据库结构:表内的数据:自定义函数: 递归查出 树下所有节点 ,参数是 父id create function sss(@id as int) returns @t table ( id int not null, name int not null, pid int null ) as begin declare @lay as int; insert into @t select * from tree where pid =@id; select @lay = min(id) from tree where pid =@id; --第一次 @l... 阅读全文

posted @ 2012-11-01 17:29 lgzh 阅读(384) 评论(0) 推荐(0) 编辑

导航