Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ordinal of a new column in snowflake table

I am trying to add a new column to an existing Table in snowflake, how to specify where to add the column. I tried the below query,

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

AFTER keyword doesn't works with Snowflake. Any suggestions on this would be helpful.

like image 771
Kannan Ramamoorthy Avatar asked May 24 '16 21:05

Kannan Ramamoorthy


People also ask

How do you find the data type of a column in a Snowflake?

Create a table that contains different types of data stored inside a VARIANT column, then use TYPEOF to determine the data types of each piece of data.

How do you make an automatic increment column in a Snowflake?

Snowflake uses a sequence to generate the values for an auto-incremented column. Sequences have limitations; see Sequence Semantics. The default value for both start and step/increment is 1 . AUTOINCREMENT and IDENTITY can be used only for columns with numeric data types.


1 Answers

Today Snowflake does not have the ability to specify the position of the added column. It is in the list of future improvements, but we don't have an ETA on this yet.

Of course there are various solutions that might help, e.g. views, but I agree we'd ideally add this ability.

Let us know if we can help with anything else.

like image 198
Marcin Zukowski Avatar answered Oct 08 '22 23:10

Marcin Zukowski