title: Need to generate n rows based on a value in a column
body: <p>I have the following table</p>
  <h1>TABLE A</h1>
  <pre><code>ID | QUANTITY
  ------------
  1  | 3
  2  | 2
  </code></pre>
  <p>What I need is</p>
  <h1>TABLE B</h1>
  <pre><code>ID | Ref No.
  ------------
  1  | MyRef1
  1  | MyRef2
  1  | MyRef3
  2  | AnotherRef1
  2  | AnotherRef2
  </code></pre>
  <p>i.e. I need to generate Table B with the same number of rows as the quantity in A with an ascending ref no. on each row.</p>
  <p>I can do it with cursors or UDFs but is there a more graceful solution?</p>