Subject | Re: [IBO] Tables and their existance |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-08-03T11:42:01Z |
Dave,
you can get the table names into a string list using the GetTableNames
method, and then check for your table name in that list. As to find if it's
empty, I think it is best to just have a cursor and call first. Maybe a
statement like
SELECT 1 FROM RDB$DATABASE
WHERE EXISTS(SELECT * FROM <YourTable>)
would be a quick way to check, but I've never tried a statement like that.
Set
you can get the table names into a string list using the GetTableNames
method, and then check for your table name in that list. As to find if it's
empty, I think it is best to just have a cursor and call first. Maybe a
statement like
SELECT 1 FROM RDB$DATABASE
WHERE EXISTS(SELECT * FROM <YourTable>)
would be a quick way to check, but I've never tried a statement like that.
Set
>Silly question.
>What is the best way (in a program using ib_connection) of finding
>whether a table exists and if so whether it is empty ?
>I do it by trying to read a record and if the table does not exist or
>is empty then of course there is an error. But this is clumsy, I
>would rather do a test of each.