Removes a sequence from the current/specified schema.
DROP SEQUENCE [ IF EXISTS ] <name> [ CASCADE | RESTRICT ]
Specifies the identifier of the sequence to drop.
If the sequence identifier is not fully-qualified (in the form of
schema_name.sequence_name), the command looks for the sequence in the current schema for the session.
CASCADE | RESTRICT
Snowflake allows the keywords
RESTRICTsyntactically, but does not act on them. For example, dropping a sequence with the
CASCADEkeyword does not actually drop a table that uses the sequence. Dropping a sequence with the
RESTRICTkeyword does not issue a warning if a table is still using the sequence.
To drop a sequence, you must be using a role that has ownership privilege on the sequence.
After dropping a sequence, creating a sequence with the same name creates a new version of the sequence. The new sequence does not resume generating numbers where the old sequence left off.
Before dropping a sequence, verify that no tables or other database objects reference the sequence.
If the dropped sequence was referenced in the
DEFAULTclause of a table, then calling
GET_DDL()for that table results in an error, rather than in the DDL that created the table.
Drop a sequence:
DROP SEQUENCE IF EXISTS invoice_sequence_number;