Comma Delimited Output – single select statement – SQL Server
We can get a comma delimited output from a single select statement in SQL Server by using the following SQL Script.
select stuff(( select ',' + CountryRegionCode
from Person.CountryRegion
for
xml path('')
), 1, 1, '') as CodeList