# Generate a range of values in Dremio

**URL:** <https://community.dremio.com/t/generate-a-range-of-values-in-dremio/8499>\
**Category:** Uncategorized\
**Created:** [December 14, 2021, 2:01pm UTC](https://community.dremio.com/t/generate-a-range-of-values-in-dremio/8499 "2021-12-14T14:01:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greeengooo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/greeengooo/32/3814_2.png) [@Greeengooo](https://community.dremio.com/u/Greeengooo)\
**Post date:** [December 14, 2021, 2:01pm UTC](https://community.dremio.com/t/generate-a-range-of-values-in-dremio/8499/1 "2021-12-14T14:01:35Z")

</div>

## Hi there! I have a question regarding creating a range of values in Dremio. I want to generate a table in a following format(this is just an example).

| n |
| --- |
| 1 |
| 2 |
| 3 |
| 4 |
| … |
| 100 |

* * *

Remark: I want to be able to set the upper and lower border of the range like in generate-series function.  
For example:  
function(a, b), where a is a lower border and b is an upper border

As far as I know there is no generate\_series function available in Dremio, so I am asking the community whether there is a possible workaround for this problem  
Thanks)

---

<div class="post-metadata">

**Author:** ![rbecher](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/rbecher/32/4420_2.png) [@rbecher](https://community.dremio.com/u/rbecher)\
**Post date:** [May 15, 2023, 12:38pm UTC](https://community.dremio.com/t/generate-a-range-of-values-in-dremio/8499/2 "2023-05-15T12:38:40Z")

</div>

Hi,  
perhaps you can create an array and then use:

```auto
SELECT FLATTEN(CONVERT_FROM('[0,1,2,3,4]', 'json'));

```

---

<div class="post-metadata">

**Author:** ![danh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/danh/32/4654_2.png) [@danh](https://community.dremio.com/u/danh)\
**Post date:** [May 16, 2023, 3:34pm UTC](https://community.dremio.com/t/generate-a-range-of-values-in-dremio/8499/3 "2023-05-16T15:34:57Z")

</div>

There is no native generate\_series functionality in Dremio as of right now.

There is, however, a potential way to get what you want. In my example below, I ran a CTAS query to create a scratch table in one of my s3 sources. As long as you run the row\_number() function against a table with at least as many rows as sequential numbers you want (100 in my case), this should work.

CREATE TABLE $scratch.RowTest AS select row\_number() over() as rnk from sys.jobs limit 100;

You can even do this with dates if you do something like the following:

CREATE TABLE $scratch.RowTest AS select row\_number()over() as rnk, DATE\_ADD(DATE ‘2023-01-01’, rnk) as “date” from sys.jobs limit 365;
