Check if table exist on sql dbHello,
I am running some jmpquery on different SQL DB. Because some DB do not have the same tables, I getting the error:
Tables (public.table1(t1)) referenced in the SQL Query were not found in the database{1} in access or evaluation of 'Table' , Table( "table1", Schema( "public" ), Alias( "t1" ) ) /*###*/
How could I check if a table exists on a SQL DB before running a query ?
Thanks
Geof
ScriptingRe: Check if table exist on sql dbit returns a table, how to get an argument? boolean ?
Re: Check if table exist on sql dbI found using the custom SQL below, it returns 0 or 1 if it exists.
Names Default To Here( 1 );
obj = New SQL Query(
Connection( "ODBC:DSN=xxxx" ),
Custom SQL(
"SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = 'table1'
);"
)
);
obj << run;