title: Extracting data between two delimiters in SQL Server?
body: <p>I have a column that contains data in the format of <strong>aaa|bbb|ccc</strong> and need to extract aaa, bbb &amp; ccc from the data separately. </p>
  
  <p>I tried</p>
  
  <pre><code>SELECT  
      SUBSTRING(Column1, 0, CHARINDEX('|', Column1)) AS [First],
      SUBSTRING(Column1, CHARINDEX('|', Column1)  + 1, LEN(Column1)) AS [Second]
  FROM
      Table1
  </code></pre>
  
  <p>OUTPUT: </p>
  
  <pre><code>aaa [FIRST],bbb|ccc [Second] 
  </code></pre>
  
  <p>but I need <code>aaa [FIRST],bbb [Second],ccc [Third]</code></p>