> Full SurrealDB documentation index: https://surrealdb.com/docs/llms.txt

# Sequence

Functions to work with sequences.

_(since v3.0.0)_

These functions can be used to work with [sequences](/docs/reference/query-language/statements/define/sequence.md).

<table>
  <thead>
    <tr>
      <th scope="col">Function</th>
      <th scope="col">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td scope="row" data-label="Function"><a href="#sequencenextval"><code>sequence::nextval()</code></a></td>
      <td scope="row" data-label="Description">Returns the next value in a sequence.</td>
    </tr>
  </tbody>
</table>

## `sequence::nextval`

The `sequence::nextval` function returns the next value in a sequence.

```surql title="API DEFINITION"
sequence::nextval($seq_name: string) -> int
```

```surql 
DEFINE SEQUENCE mySeq2 BATCH 1000 START 100 TIMEOUT 5s;
sequence::nextval('mySeq2');
```

```surql title="Output"
100
```
