Concat column values with comma as the separator
<p>I am trying to figure out the result of the below query on how to concat all the columns into a single string with comma separated values. The number of values can be dynamic.</p>

<pre><code>SELECT 'Sc4','Sc5','Sc8','Sc7','Sc2'
</code></pre>

<p>I want the result to be as below:</p>

<pre><code>Sc4,Sc5,Sc8,Sc7,Sc2
</code></pre>

<p>I have tried using stuff but did manage to concat the string but unable to insert comma in between.</p>

<p>Below is what i have tried</p>

<pre><code>SELECT Stuff((SELECT 'Sc4','Sc5','Sc8','Sc7','Sc2' FOR XML PATH('')), 2, 0, '');
</code></pre>

<h2>UPDATE</h2>

<p>I would like to rephrase my question, is there any way the out shown below can be converted to csv</p>

<p><a href="https://i.stack.imgur.com/S81H0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S81H0.png" alt="Result"></a></p>