Subject Re: [firebird-support] Avoid error creating table by script
Author Almond
At 08:56 2004.09.23, Luciano R. Machado wrote:
>Hi,
>
>Is there some way to check if a table already exists when creating
>a new table by a script.sql?
>

Query system table can do this trick. Since firebird put all db information
on system tables, you can check the file exist or not.

select count(*) from RDB$RELATION_FIELDS where
RDB$RELATION_NAME = 'filename';

I don't exactly remember the system table contain the table name. The above
query would return the no. of fields inside a table. If your table contain
at least one field, it works. You need to found the proper system table
name if your table is a null table. And remember file name should be in
upper case.

Hope this help.

Almond Wong



>--
>Luciano R. Machado
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>