declare @output varchar(8000)select @output=coalesce(@output,'')+ Convert(varchar(50),CityId)+','from AreMSCrm_ChannelDistributionByCity_Tempselect @output=substring(@output,1,len(@output)-1)print @output