I have the following table
ID | QUANTITY ------------ 1 | 3 2 | 2
What I need is
ID | Ref
This would also do the trick. It uses recursion, creates a table with rows 1-100.
WITH NBR ( NUM ) AS ( SELECT 1 UNION ALL SELECT 1 + NUM FROM NBR WHERE NUM < 100 ) SELECT * into NUMBERS from NBR