title: T-SQL Unpivot with column values
body: <p>I have a table like below:</p>
  
  <blockquote>
    <h2>Check |  Bill Total  | D1 | D2 | D3 | D4 | D5 |</h2>
  
  <pre><code>1              100       10           2
  2               50       10                   5    7
  </code></pre>
  </blockquote>
  
  <p>D1 - D5 stands for different discount type, how can I get to the following?</p>
  
  <blockquote>
    <h2>Check |  Bill Total  | Discount Type | Discount |</h2>
  
  <pre><code>1        100            D1             10
  1        100            D3              2
  2        100            D1             10
  2        100            D4              5
  2        100            D5              7
  </code></pre>
  </blockquote>
  
  <p>Many Thanks.</p>