xml应该可以实现吧?
<mailno 20031201>
       <reperson>
              John
       </reperson>
       <reperson>
              rose 
       </reperson>
       <createby>
              yulin
       </createby>
</mailno>  但我不知道具体怎么实现,好像先的定义XML的表示结构。

解决方案 »

  1.   

    用一個自定義函數實現.(先拆分,後闔並)
    create function f_getname(@str varchar(8000))
    returns varchar(8000)
    as
    begin
            declare @restr varchar(8000)
            declare @tem varchar(30)
            declare @ine int
            select @restr=''
            select @ine=0
            select @ine=charindex(',',@str)
            if @str='SENDALL'
                  begin
                          select @restr='全体'
                          return(@restr)
                  end
            while @ine<>0
                    begin
                            select @tem=substring(@str,1,@ine-1)
                            if @restr<>''
                                    select @restr=@restr+','+(select lname from asyuser where userno=@tem)
                            else
                                    select @restr=(select lname from asyuser where userno=@tem)
                            select @str=substring(@str,@ine+1,datalength(@str))
                            select @ine=charindex(',',@str)
                   end 
            if @restr<>''
                    select @restr=@restr+','+(select lname from asyuser where userno=@str)
            else
                    select @restr=(select lname from asyuser where userno=@str)
            return(@restr)
    end