title: SQL: Count of items in comma-separated column in a table
body: <pre><code>Column1
  --------
  1,2,4
  2,3,5
  2,1,3
  </code></pre>
  
  <p>I have a column in a table which is comma-separated as shown above. From which I need to get below output:</p>
  
  <pre><code>No   Count
  ----------
  1     2
  2     3
  3     2
  4     1
  </code></pre>
  
  <p>When I tried with </p>
  
  <pre><code>SELECT SUM(LEN(Holidays) - LEN(REPLACE(Holidays, ',', '')) + 1)  
  FROM [dbo].[OhLog]
  </code></pre>
  
  <p>I'm not getting item wise count. Instead it is getting full count.</p>