Rename column in Snowflake table, simply explained

Renaming a column in Snowflake is a common and easy task to undertake by using the alter table command, here is the simplest example of how to rename a column:

alter table table_name rename column old_column_name to new_column_name

Rename column in Snowflake if table exists already

We can build upon the simple example we showed previously by adding an if exists constraint, which checks first if the table exists before renaming the column in the table. This is helpful as it stops potential errors being returned.

alter table if exists table_name rename column old_column_name to new_column_name

Renaming a column in Snowflake, things to watch out for

When renaming a column, there are three things to keep in mind:

  • The new column name must not be currently used in the table
  • Renaming the column does not update references to that table in other objects (such as view definitions), so this must be updated to the new name manually
  • Columns that are part of the clustering key cannot be renamed

Other alter table commands

The alter table command is the key to modifying the properties, columns, or constraints of a table in Snowflake. Other commands that you might want to work with are:

Add column to Snowflake table
Add multiple columns to Snowflake table


Snowflake alter table documentation

Stephen Allwright

Stephen Allwright

I'm a Data Scientist currently working for Oda, an online grocery retailer, in Oslo, Norway. These posts are my way of sharing some of the tips and tricks I've picked up along the way.
Oslo, Norway