> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DROP SEQUENCE

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `DROP SEQUENCE` <InternalLink path="sql-statements">statement</InternalLink> removes a sequence from a database.

<Note>
  The \`\` statement performs a schema change. For more information about how online schema changes work in CockroachDB, see <InternalLink path="online-schema-changes">Online Schema Changes</InternalLink>.
</Note>

## Required privileges

The user must have the `DROP` <InternalLink path="security-reference/authorization#managing-privileges">privilege</InternalLink> on the specified sequence(s).

## Synopsis

<img src="https://mintcdn.com/cockroachlabs/WFQ6LFOxKnUpgIkd/images/sql-diagrams/v24.1/drop_sequence.svg?fit=max&auto=format&n=WFQ6LFOxKnUpgIkd&q=85&s=152b195779d6e6ba02689b26f71f4e1c" alt="drop_sequence syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="731" height="113" data-path="images/sql-diagrams/v24.1/drop_sequence.svg" />

## Parameters

| Parameter            | Description                                                                                                                                  |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `IF EXISTS`          | Drop the sequence only if it exists; if it does not exist, do not return an error.                                                           |
| `sequence_name_list` | A comma-separated list of sequence names. Find the sequence name with `SHOW CREATE` on the table that uses the sequence.                     |
| `RESTRICT`           | *(Default)* Do not drop the sequence if any objects (such as <InternalLink path="constraints">constraints</InternalLink> and tables) use it. |
| `CASCADE`            | Not implemented. You can drop a sequence only if nothing depends on it.                                                                      |

## Examples

### Remove a sequence (no dependencies)

In this example, other objects do not depend on the sequence being dropped.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> CREATE SEQUENCE even_numbers INCREMENT 2 START 2;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW SEQUENCES;
```

```
  sequence_schema | sequence_name
------------------+----------------
  public          | even_numbers
(1 row)
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> DROP SEQUENCE even_numbers;
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW SEQUENCES;
```

```
  sequence_schema | sequence_name
------------------+----------------
(0 rows)
```

## See also

* <InternalLink path="create-sequence">`CREATE SEQUENCE`</InternalLink>
* <InternalLink path="alter-sequence">`ALTER SEQUENCE`</InternalLink>
* <InternalLink path="show-sequences">`SHOW SEQUENCES`</InternalLink>
* <InternalLink path="functions-and-operators">Functions and Operators</InternalLink>
* <InternalLink path="sql-statements">SQL Statements</InternalLink>
* <InternalLink path="online-schema-changes">Online Schema Changes</InternalLink>
