# GENERATOR() Function

### Description

Creates rows of data based either on a specified number of rows, a specified generation period (in seconds), or both

### Syntax

```sql
GENERATOR( ROWCOUNT => count [ , TIMELIMIT => sec ] )
```

### Parameters

| Parameter | Description | Required |
| --- | --- | --- |
| _count_ | The number of rows to return | Yes |
| _sec_ | The number of seconds the query should run | Yes |

#### Notes

-   _count_ and _sec_ must be non-negative numbers
-   If only the ROWCOUNT argument is specified, the resulting table will contain count rows
-   If only the TIMELIMIT argument is specified, the query runs for sec seconds, generating as many rows as possible within the time frame
-   If both the ROWCOUNT and TIMELIMIT arguments are specified, then:
    -   If the ROWCOUNT is reached before the TIMELIMIT, the resulting table will contain count rows
    -   If the TIMELIMIT is reached before the ROWCOUNT, the table will contain the number of rows generated within the time frame
-   If ROWCOUNT or TIMELIMIT is null, it will be ignored, so `generator(ROWCOUNT => null)` generates 0 rows
-   If both parameters (ROWCOUNT and TIMELIMIT) are omitted, the GENERATOR function returns 0 rows

### Example

```sql
SELECT
    SEQ4() AS NUM
FROM
    TABLE (GENERATOR(ROWCOUNT=>10)) AS SEQ;
```

Source: https://developer.rippling.com/documentation/rippling-platform/transformations/sql-reference/generator

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
