tree

create function f_pid(@id varchar(3)) returns @t_level table(id varchar(3))  
as  
begin  
insert into @t_level select @id  
select @id = IDParent from NodeNet where IDChild = @id and IDParent is not null  
while @@ROWCOUNT > 0  
begin  
insert into @t_level select @id select @id = IDParent from NodeNet where IDChild = @id and IDParent is not null  
end  
return  
end  
go 

posted @ 2014-03-04 13:24  小川丶  阅读(137)  评论(0编辑  收藏  举报