解决方案 »

  1.   

    ;with Args as 
    (
    select * from Taba where charindex(','+rtrim(pid),',' + @para1,1) > 0 
    union all 
    select * from Taba ,Args
    where Taba .id = Args.pid
    )
    select id = ',' + rtrim(id) from Args ;
      

  2.   


    create proc proc_test
    @para1 varchar(8000) = null
    as 
    begin
        ;with Args as ( select * from Taba where charindex(','+rtrim(pid),',' + @para1,1) > 0 union all select * from Taba ,Args where Taba .id = Args.pid ) select id = ',' + rtrim(id) from Args ; 
    end 
      

  3.   

    you_tube 
    黑木崖上的蜗牛万分感谢你。谢谢!!!!