Ask Your Question
3

How can a default timestamp be added to an existing table in Snowflake by creating a new column?

asked 2023-05-01 09:17:57 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-05-01 09:34:01 +0000

djk gravatar image

To add a default timestamp column to an existing table in Snowflake, you can use the ALTER TABLE command with the ADD COLUMN clause as follows:

ALTER TABLE table_name ADD COLUMN new_column_name TIMESTAMP DEFAULT CURRENT_TIMESTAMP;

Here, "tablename" is the name of the table where the new column will be added, "newcolumnname" is the name you want to give to the new column, "TIMESTAMP" is the data type of the column, and "DEFAULT CURRENTTIMESTAMP" sets the default value of the column to the current system timestamp.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-01 09:17:57 +0000

Seen: 10 times

Last updated: May 01 '23