Reputation: 11619
I have this field which is a Record type with 3 sub-fields in a table (let's say table A). I want to copy to this table from another table (let's say table B) where these 3 fields are separate fields in BigQuery:
Table A:
env Record
env.temp INTEGER
env.ts TIMESTAMP
env.desc STRING
Table B:
env_temp INTEGER
env_ts TIMESTAMP
env_desc STRING
I have no idea how to construct INSERT SQL statement in particular for this Record field (env):
INSERT table_A (env) SELECT ???? FROM table_B
Please enlighten me !
Upvotes: 7
Views: 10108
Reputation: 33705
You need to make a STRUCT
, e.g.:
INSERT table_A (env)
SELECT STRUCT(env_temp AS temp, env_ts AS ts, env_desc AS desc) AS env
FROM table_B
Upvotes: 7