日期:2014-05-18 浏览次数:20698 次
select replace((select ','+name from 表1 order by id for xml path('')), ',', '')
------解决方案--------------------
SELECT name+'' FROM [ta] FOR XML PATH('')
------解决方案--------------------
DECLARE @STR VARCHAR(8000) SELECT @STR=ISNULL(@STR+'','')+name FROM (SELECT DISTINCT NAME FROM A)AS T SELECT @STR