title: Parse code into two column table
body: <p>I'm trying to parse a cvss score into a data table. Starting with a code that looks something like this: <code>AV:N/AC:H/PR:L/UI:R/</code></p>
  
  <p>I need to produce a table that looks like this</p>
  
  <pre><code>   Metric   Attribute
  1  AV       N
  2  AC       H
  3  PR       L   ...etc
  </code></pre>
  
  <p>I have a function that creates one column with each Metric-Attribute pair, however, I'm not sure how to separate them into separate columns. Does anyone have any ideas here?</p>
  
  <pre><code>ALTER FUNCTION [dbo].[Split]
  (
      @String NVARCHAR(4000),
      @Delimiter NCHAR(1)
  )
  RETURNS TABLE
  AS
  RETURN
  (
          WITH Split(stpos,endpos)
      AS(
          SELECT 0 AS stpos, CHARINDEX(@Delimiter,@String) AS endpos
          UNION ALL
          SELECT endpos+1, CHARINDEX(@Delimiter,@String,endpos+1)
              FROM Split
              WHERE endpos &gt; 0
      )
  
  
      SELECT 'Metric:Attribute' = SUBSTRING(@String,stpos,COALESCE(NULLIF(endpos,0),LEN(@String)+1)-stpos)
      FROM Split
  )
  </code></pre>