title: SQL SERVER - Split a Comma Separated Number Into Two Columns
body: <p>I have a <strong>Column A</strong> that contains integers. In some cases, the column will contain a comma-separated list of two integers represented as a string.</p>
  
  <p>Example: 1,2 . In this situation I need to do two things. </p>
  
  <ol>
  <li>Identify if data has comma or not. If not populate value into <strong>Column B</strong>. </li>
  <li>If it does have a comma, it needs to populate the first number into <strong>Column C</strong> and the Second into <strong>Column B</strong></li>
  </ol>
  
  <p>If it helps to understand the problem better, we have a data vendor that has updated an ID field in their data. Their idea of maintaining the legacy ID is to simply list it followed by the new ID separated by a comma. Why they choose to do this instead of creating new columns I have no idea. I am sure they have their reasons. </p>