4
votes

I want to add a column in an existing table but not at the end , in between other columns does snowflake allow this

something like this

ALTER TABLE MY_DB.MY_SCHEMA.MY_TABLE ADD COLUMN MY_NEW_COLUMN NUMBER(38,0) AFTER MY_OLD_COLUMN1;

1

1 Answers

4
votes

You can't control the ordering when you add a new column. However you can create and maintain a VIEW that orders columns in whatever sequence makes sense, different from the underlying table.

(You can also create a new table using CREATE TABLE ... AS SELECT ... and reorder columns, and then rename the new table to the old table.)