字符串合并与分解

字符串合并与分解

Select * From F_Splitstr('1,3,2,3',',') 

select stuff((
        select  distinct ','+ F1
        from F_Splitstr('1,3,2,3',',') 
        for xml path('')
    ),1,1,'')


select stuff((select distinct ','+ F1  from F_Splitstr('1,3,2,3',',') for xml path('')),1,1,'')


实际使用时的套用
	select @FProductBarCode=stuff((select distinct ','+ FProductBarCode
	from (
		select FProductBarCode
		from #tmpBarcode M
		where M.FContractNo=@FContractNo and M.FXC=@FXC
	) M
	for xml path('')),1,1,'')

  

select stuff((select distinct ','+ F1 from F_Splitstr('1,3,2,3',',') for xml path('')),1,1,'')


实际使用时的套用
select @FProductBarCode=stuff((select distinct ','+ FProductBarCode
from (
select FProductBarCode
from #tmpBarcode M
where M.FContractNo=@FContractNo and M.FXC=@FXC
) M
for xml path('')),1,1,'')

猜你喜欢

转载自www.cnblogs.com/Rain635926522/p/12008937.html