title: Parse JSON Array in T-SQL
body: <p>In our SQL Server table we have a json object stored with an array of strings. I want to programatically split that string into several columns. However, I cannot seem to get it to work or even if it's possible. </p>
  
  <p>Is this a possibility to create multiple columns within the WITH clause or it is a smarter move to do it within the select statement?</p>
  
  <p>I trimmed down some of the code to give a simplistic idea of what's given.</p>
  
  <p>The example JSON is similar to <code>{ "arr": ["str1 - str2"] }</code></p>
  
  <pre><code>SELECT b.* FROM [table] a
  OUTER APPLY
  OPENJSON(a.value, '$.arr')
  WITH
  (
      strSplit1 VARCHAR(100) SPLIT('$.arr', '-',1),
      strSplit2 VARCHAR(100) SPLIT('$.arr', '-',2)
  ) b
  </code></pre>