DECLARE @STR VARCHAR(8000)
SELECT @STR=ISNULL(@STR+‘,‘,‘‘)+weixinuser FROM (SELECT DISTINCT weixinuser FROM v_sysbinduser)AS T
SELECT @STR
declare @output varchar(8000)
select @output = coalesce(@output + ‘,‘ , ‘‘) + weixinuser from v_sysbinduser
print @output
原文:http://www.cnblogs.com/yuanxiuzhi/p/3797172.html