Subject RE: [firebird-support] Table is empty
Author Gustavo
I know the table is NOT empty if any select that should return at least one row, returns at least one row. That's why I use the query

SELECT FIRST 1 FIELD1 FROM TABLE1

and check if the result is empty. What I don't to know is if this is the best way to do this. I think it's the best because the query is not bigger than only one field. But I'm not sure because I don't know how this select is done internally. That's why I'm asking if there is a better way. Does anybody knows this?

Gustavo
----- Mensaje original -----
De: Sam Hunt
Para: firebird-support@yahoogroups.com
Enviado: Lunes, 20 de Junio de 2005 14:16
Asunto: Re: [firebird-support] Table is empty


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.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




[Non-text portions of this message have been removed]