title: Multiple rows to one comma-separated value in Sql Server
body: <p>I want to create a table valued function in SQL Server, which I want to return data in comma separated values.</p>
  
  <p>For example table: <code>tbl</code></p>
  
  <pre><code>ID | Value
  ---+-------
   1 | 100
   1 | 200
   1 | 300     
   1 | 400 
  </code></pre>
  
  <p>Now when I execute the query using the function <code>Func1(value)</code></p>
  
  <pre><code>SELECT Func1(Value) 
  FROM tbl 
  WHERE ID = 1
  </code></pre>
  
  <p>Output that I want is: <code>100,200,300,400</code></p>