UNDROP TABLE¶

Restores the most recent version of a dropped table.

See also:

CREATE TABLE , ALTER TABLE , DROP TABLE , SHOW TABLES , DESCRIBE TABLE

Syntax¶

UNDROP TABLE <name>
Copy

Parameters¶

name

Specifies the identifier for the table to restore. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

Usage Notes¶

  • Restoring tables is only supported in the current schema or current database, even if the table name is fully-qualified.

  • If a table with the same name already exists, an error is returned.

  • UNDROP relies on the Snowflake Time Travel feature. An object can be restored only if the object was deleted within the Data Retention Period. The default value is 24 hours.

Examples¶

Restore the most recent version of a dropped table (this example builds on the examples provided for DROP TABLE):

UNDROP TABLE t2;

+---------------------------------+
| status                          |
|---------------------------------|
| Table T2 successfully restored. |
+---------------------------------+
Copy