20 October 2018        Add to Favorites   Report

Rename a table in Snowflake

Snowflake offers the user the flexibility to rename a table in the database. You will need to have "create table" access to do this operation. 

ALTER TABLE EMP_HIST RENAME TO EMPLOYEE_HISTORY;

Renames the specified table with a new identifier that is not currently used by any other tables in the schema

ALTER TABLE [ IF EXISTS ] <name> SWAP WITH <target_table_name>

Swaps all content and metadata between two specified tables, including any integrity constraints defined for the tables. Also, swap all access control privilege grants. The two tables are essentially renamed in a single transaction

Copied