SQL Select 'n' records without a Table

Viewed 25787

Is there a way of selecting a specific number of rows without creating a table. e.g. if i use the following:

SELECT 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

It will give me 10 across, I want 10 New Rows.

Thanks

9 Answers

Using GENERATE_SERIES - SQL Server 2022

Generates a series of numbers within a given interval. The interval and the step between series values are defined by the user.

SELECT value
FROM GENERATE_SERIES(START = 1, STOP = 10);
Related