查询无限极分类下的所有子节点
create function [dbo].[f_getDOWN](@id int)
returns @re table(id int)
as
begin
insert into @re select id from tb_productclass where id=@id
while @@rowcount>0
insert into @re select a.id
from tb_productclass a inner join @re b on a.FatherId=b.id
where a.id not in(select id from @re)
return
end