lundi 30 août 2021

BIGQUERY: IF table exists start query SQL

I want to execute my SQL command, if a certain table "t1" exists in the the dataset "d".

I tried:

IF (EXISTS (Select * From d.INFORMATION_SCHEMA.TABLES WHERE Table_Schema like 't1*')) Then ---DO Stuff---- Else Stop query and repeat in 1 hour;

The last part doesnt work. Syntax error: Expected ";" but got keyword END.

Thanks a lot.

Aucun commentaire:

Enregistrer un commentaire