What SQL query can I use to check if a table exists.
I need to support different versions of schema, and some deployments can miss certain tables
If they are Cache tables, you may use the %Dictionary.CompiledClass system table.
select id from %Dictionary.CompiledClass where SqlSchemaName='%BI' and SqlTableName='Alerts'
Or, if you know Cache class name of your table,
select id from %Dictionary.CompiledClass where ID='%BI.Alerts'
These queries will return 1 row if table %BI.Alerts exists.