SELECT STUFF((SELECT ','+字段 FROM 表名 for xml path('')),1,1,'')
摘自:https://www.cnblogs.com/527289276qq/p/4808176.html
SQLServer2000不支持FOR XML PATH()
declare @s varchar(8000)set @s = ''select @s = @s + 字段 + ',' from 表名 set @s = stuff(@s,len(@s),1,'')SELECT @s