SELECT cast(id as varchar(8)) new_id FROM tourol_Atractions where tcid>0 order by new_id SELECT top 1 new_id = stuff ((SELECT ',' + cast(id as varchar(8)) FROM tourol_Atractions WHERE tcid>0 FOR xml path('')), 1, 1, '') FROM [tourol_Atractions] where tcid>0
结果如下