ALTER TABLE … RENAME TO changes a table’s name in Snowflake without touching its data, schema, or privileges.
The command changes an existing table’s name instantly at the metadata level.Data, permissions, clustering keys, and Time Travel history stay intact.
Typical reasons include business-term updates (Orders
➜ CustomerOrders
), archiving (Orders
➜ Orders_2023
), or refactoring schemas during migrations.
ALTER TABLE Orders RENAME TO CustomerOrders;
ALTER TABLE IF EXISTS Orders RENAME TO CustomerOrders;
ALTER TABLE sales.Orders RENAME TO archive.CustomerOrders_2023;
Views and grants automatically follow the new name, but raw SQL in apps or ETL jobs will not.Track and update hard-coded references.
• Qualify names with schema to avoid ambiguity.
• Use IF EXISTS in automated pipelines.
• Record the change in version control and notify teams.
See details in the mistakes section below.
Yes—run another ALTER TABLE … RENAME TO
returning the table to its original name, provided no new object now uses that name.
.
No. The operation is metadata-only and completes almost instantly without blocking reads or writes.
Yes. In Snowflake Scripting, build dynamic SQL with the IDENTIFIER()
function to insert variable values.
Yes. Historical data remains accessible through the new table name because Time Travel follows the physical table, not its identifier.