Subject Re: [firebird-support] Table is empty
Author Sam Hunt
Gustavo wrote:

>Hello everybody:
>
> I want to know if a table is empty or not and I'm using the next query:
>
>SELECT FIRST 1 FIELD1 FROM TABLE1
>
> and then I check if the result is empty or not.
>
> I think this is the best way to do this because the result is only one field of one record (or none if the table is empty) and it should have the best performance.
>
> Is this true? Is there a better way to do this?
>
> Thanks in advance.
>
>Gustavo
>
>
>[Non-text portions of this message have been removed]
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit http://firebird.sourceforge.net and click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
the table is empty, if you execute any select that should return at
least one row.
I test for EOF after my select.

Note: I had problems with early versions of MS MDAC and IB6 when testing
for EOF and BOF. Best to use MDAC 2.6 (or was it 2.7?) or later.
You'll know if your dev environment can't do this. You'll receive an
error when testing BOF or EOF.
Sam H.