Skip to content Skip to sidebar Skip to footer

Big Query - Create A Table/view From A Temp Table

We have a query in Big Query like below CREATE temp table ttt as ( SELECT * FROM TABLE ); EXECUTE IMMEDIATE ( ---Dynamic query goes here--- ); The above query is storing th

Solution 1:

Try to use:

EXECUTE IMMEDIATE (concat('create table dataset.table as ',---Dynamic query goes here---)
); 

Solution 2:

Could you use a persistent table in the first place? Or could you save the results after EXECUTE IMMEDIATE using query below?

CREATETABLE yourDataset.ttt as (
  SELECT*FROM ttt
);

Solution 3:

As I already suggested you in your previous question - just add CREATE TABLE your_table AS or INSERT your_table as in below example. Use CREATE (DDL) or INSERT (DML) depends on do you need to create new table or insert into existing one

EXECUTE IMMEDIATE (
  CREATETABLE dataset.table ASSELECT---Rest of your dynamic query goes here--- 
); 

Post a Comment for "Big Query - Create A Table/view From A Temp Table"