'I am having error while writing a sql query in bigqquery

create or replace mythirdproject-345809.Test_dataset.Head_Of_country_cdc as select * , current_timestamp as created_dt, current_timestamp as last_updated_dt, 'Initial Load' as last_updated_by, from mythirdproject-345809.Test_dataset.Head_Of_country;

I tried creating a table using sql query in bigquery but i am getting error

(mythirdproject is not a supported object type at [1:19])



Solution 1:[1]

This happens because you don't specify the type of object that you are trying to create. The correct command is CREATE [OR REPLACE] TABLE <table_name> so your query should be:

CREATE OR REPLACE TABLE `mythirdproject-345809.Test_dataset.Head_Of_country_cdc` AS 
SELECT * , 
CURRENT_TIMESTAMP AS created_dt, 
CURRENT_TIMESTAMP AS last_updated_dt, 
'Initial Load' AS last_updated_by 
FROM `mythirdproject-345809.Test_dataset.Head_Of_country`;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 itroulli