1-- Concatenates results into one single varchar with separator
2SELECT LISTAGG(column_name, ',') WITHIN GROUP (ORDER BY column_name)
3FROM YOUR_TABLE;
1Select CountryName from Application.Countries
2
3Declare @val Varchar(MAX);
4Select @val = COALESCE(@val + ', ' + CountryName, CountryName)
5 From Application.Countries Select @val;
6