Reputation: 105
I would like to know a way of adding one additional column to a BigQuery table, that will populate all the rows for this newly created column with specific constant value. I know how to create column with NULL values:
ALTER TABLE project_id.dataset.table
ADD COLUMN A STRING
But my goal is to also add the ingestion time with CURRENT_TIMESTAMP() function. Is it even possible with one command? Or maybe I need to apply subsequently some second command?
Upvotes: 2
Views: 4189
Reputation: 105
Seems like a solution is to use another query after the mentioned one:
UPDATE project_id.dataset.table SET A = CAST(CURRENT_TIMESTAMP() AS STRING) WHERE 1=1
Upvotes: 3