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

Atori

posted on 20 Oct 18

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds