---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/generate-series.md
cuppy_section: docs
cuppy_doc: V7AH-TFMG
cuppy_doc_uuid: ab03eac2-efa8-49f5-ac0b-911468593b07
cuppy_permalink: https://cuppy.io/salesforce/d/V7AH-TFMG
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/generate-series
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: 32fc3d09bcd9eafede8e48f19186d7a1182b3318fad03bd5fc7db9996ee90455
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/generate-series.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

## `generate_series` (Numerical)

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Generate a series of values, from `start` to `stop` with a given `step` size.

*   `<start>`: The start value of the series.
*   `<stop>`: The end value of the series.

*   `<step>`: The step size. The default step size is `1`.

Returns a set of rows, where each row has a single column, containing the generated series of values.

There are two versions of `generate_series`:

*   The numerical version
*   The time-based version

This page describes the numerical version. The time-based version is described in the [generate_series (Time-based)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/generate-series-time.html) section.

The following considerations apply to both versions of `generate_series`:

*   Both the `start` and `stop` values are included in the generated series. I.e., both boundaries are inclusive.
*   The step size must be non-zero.
*   The step size can also be negative. For negative step sizes, `start` must be greater than `stop`.
*   For positive step sizes, if `start` is greater than `stop`, the function returns no rows.
*   For negative step sizes, if `start` is less than `stop`, the function returns no rows.
*   If any input is `null`, the function returns no rows.

See the [generate_series (Time-based)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/generate-series-time.html) page for additional considerations for the time-based version.

Without a step size, `generate_series` generates all values between `start` and `stop`, with a step size of `1`. Note how the result set contains both `2` and `4`, i.e. the `start` and `end` boundaries are inclusive.

Results:

| generate_series |
| --- |
| 2 |
| 3 |
| 4 |

If an explicit step size is provided, `generate_series` generates all values between `start` and `stop`, with the given step size.

Results:

| generate_series |
| --- |
| 1 |
| 3 |
| 5 |

For negative step sizes, the function returns the series in reverse order. `start` must be greater than `stop` in this case.

Note that in SQL, rows within a row set are usually unordered. Hence, the following query uses `WITH ORDINALITY` to instruct `generate_series` to also number the generated rows. The `ORDER BY` clause then ensures that the query indeed returns values in this specific order.

Results:

| generate_series | ordinality |
| --- | --- |
| 5 | 1 |
| 3 | 2 |
| 1 | 3 |

For the following query, `start` is greater than `stop`, so the function returns an empty row set.

You can also use fractional numbers as `start`, `stop` and even `step` values.

Results:

| generate_series |
| --- |
| 1.1 |
| 2.4 |
| 3.7 |

*   [Set Returning Functions](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/set-returning-functions.html)
*   [`generate_series` (Time-based)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/generate-series-time.html) - the time-based version of this function
*   [`ARRAY_GENERATE_SERIES` (Numerical)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/array-generate-series.html) - the array-returning version of this function


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
