1.所有的子节点查询到树结构中所有父节点 RETURNS @Tree Table(PID )) as begin --DECLARE @ID VARCHAR() --SET @ID = ' ;with rolDepList as ( ) union all select a.PID,a.FID,a.Name from tbDepList a join rolDepList b on a.pid=b.fid ) Insert @Tree select distinct(PID),FID,Name…