RB Smissaert wrote:
Trying to find the fastest way to determine if a table has no rows.

I think this will do:
SELECT (SELECT ROWID FROM table limit 1) IS NOT NULL;
If a table has rows then the result should be 1.

But I am not sure if a table always has the hidden field ROWID.

RBS



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


RB,

This was discussed recently in this thread http://www.mail-archive.com/sqlite-users@sqlite.org/msg19148.html

I believe Igor's suggestion is optimal for SQLite. It may be faster to add a limit clause to the subquery for other database engines.

HTH
Dennis Cote

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to