Similar to Select All Columns Except Some in Google BigQuery? - we want to SELECT *
from the table, but instead of excluding some columns, we want to replace them with some expression. For example, given table with columns: name, start_date, amount, end_date, comment
, we want to convert start
and end
from STRING
to DATE
. It is possible to write
SELECT
* EXCEPT(start_date, end_date),
CAST(start_date AS DATE) start_date,
CAST(end_date AS DATE) end_date
But this would change order of columns moving start and end to the end.