I've seen the following used to return a list of numbers
SELECT TOP (SELECT MAX(Quantity) FROM @d)
rn = ROW_NUMBER() OVER (ORDER BY object_id)
FROM sys.all_columns
ORDER BY object_id
if the max quantity is 5 then I assume the above returns:
rn
1
2
3
4
5
Is there a more elegant, or even canonical, approach within T-SQL to return this list of numbers?