# SEQUENCE

Config path: `/<database>/<schema>/sequence/<name>.yaml`

Example:

```yaml
start: 1
interval: 1
```

## Schema

* **start** (int) - starting value for sequence (default: 1)
* **interval** (int) - sequence step (default: 1)
* **is\_ordered** (bool) - enforce ordered mode (true) or non-ordered (false) mode for newly created sequence. If omitted, value of `NOORDER_SEQUENCE_AS_DEFAULT` account parameter is automatically used as default.
* **comment** (str)

## Usage notes

1. **Start** is applied on creation of sequence only. Existing sequences always retain their current value.
2. All sequences must be created explicitly and assigned to `default_sequence` of relevant table columns. It helps to preserve sequence value when table must be re-created to apply changes which cannot be applied via `ALTER TABLE`.
3. It is possible to convert an existing ordered sequence into a non-ordered mode. But it is not possible to do it in reverse.

## Links

* [CREATE SEQUENCE](https://docs.snowflake.com/en/sql-reference/sql/create-sequence.html)
* [ALTER SEQUENCE](https://docs.snowflake.com/en/sql-reference/sql/alter-sequence.html)
* [SHOW SEQUENCES](https://docs.snowflake.com/en/sql-reference/sql/show-sequences.html)
* [DESC SEQUENCE](https://docs.snowflake.com/en/sql-reference/sql/desc-sequence.html)
* [Using Sequences](https://docs.snowflake.com/en/user-guide/querying-sequences.html)
* [Parser & JSON Schema (GitHub)](https://github.com/littleK0i/SnowDDL/blob/master/snowddl/parser/sequence.py)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snowddl.com/basic/yaml-configs/sequence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
