-1
  SELECT TOP 10 ROW_NUMBER() OVER (ORDER BY [object_id]) 
  FROM sys.all_columns

Running that code im able to get a incrementing count shown below.

1
2
3
4
5
6
7
8
9
10
...

im looking for a way to get multiples of a number, for example, 28

28
56
84
112
140
...

2 Answers2

1

You need a way to generate a list of numbers

https://stackoverflow.com/a/33146869/3470178

SELECT 24 * I as multi
FROM (
        SELECT (ones.n + 10*tens.n) as i
        FROM (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),
             (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) tens(n)
        WHERE ones.n + 10*tens.n < 100 -- Your Limit
      ) T
ORDER BY multi
Community
  • 1
  • 1
Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118
0

If we are using the same idea :

SELECT TOP 10 yourNumber * ROW_NUMBER() OVER (ORDER BY [object_id]) 
FROM sys.all_columns

It will give your number * 1, then your number * 2, ...

Izuka
  • 2,572
  • 5
  • 29
  • 34