select multiple rows of a column into a comma-separated list sql based on a list of columns code example
Example: convert rows to string sql server
Select CountryName from Application.Countries
Declare @val Varchar(MAX);
Select @val = COALESCE(@val + ', ' + CountryName, CountryName)
From Application.Countries Select @val;