Subject | Re: [ib-support] is table empty? |
---|---|
Author | Martijn Tonies |
Post date | 2003-05-12T15:54:42Z |
Hi Fred,
can also read this group via a new-reader interface? You might be
able to find the thread without problems. Alternatively, log-in to
Yahoo and search the newsgroup archives.
In short - you can use:
SELECT min(pkcolumn) FROM table
If this returns a value, there's at least a single row.
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com
See you at the First European Firebird Conference in May in Fulda, Germany
http://www.firebird-conference.com
> I am converting a database from Informix to Firebird. So far, I havefound
> Firebird to be quite up to the task and am very impressed with itsmaturity,
> performance, and reliability. I do have a question: Informix keeps rowfor
> count information in its table control structures so "select count(*) from
> table" is instantaneous even if the table contains a billion rows. It
> appears that Firebird actually counts the rows. In my app this query is
> often used to determined if a table is empty, so I suppose I could write a
> stored procedure that opens a cursor, does a fetch, and returns a yes/no
> table "emptiness". Is there a more elegant way to determine if a table isThis was recently discussed in this newsgroup. Did you know you
> empty in Firebird?
can also read this group via a new-reader interface? You might be
able to find the thread without problems. Alternatively, log-in to
Yahoo and search the newsgroup archives.
In short - you can use:
SELECT min(pkcolumn) FROM table
If this returns a value, there's at least a single row.
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com
See you at the First European Firebird Conference in May in Fulda, Germany
http://www.firebird-conference.com