I have a table that has a nested record (please see attached snapshot).
I am trying to do a simple insert but it's not working.
INSERT INTO `my_project.my_dataset.test_table`(name,address,comments)
values(
'my_name' as name,
[STRUCT('ABC' as line1,'XYZ' as line2,10 as code),
STRUCT('PQR' as line1,'STU' as line2,20 as code)],
'Comment')
Any idea what's wrong with this SQL insert statement?
Thanks a lot for your help.
Don't assign names in
values
. Try:Or use
insert . . . select
: