Subject Re: Spam Alert: Re: [ib-support] How can I check if a table is empty?
Author Helen Borrie
At 11:58 AM 7/05/2003 +1000, you wrote:
>PODESTA Mariano APRE wrote:
>
> > try
> >
> > if (exists (select * from MyTable)) then
> > ..
> >
> > this statement is fast and does not fetch all records.
>
>How would you use that in Delphi with IBX?

It's a PSQL construct so - by calling a stored procedure that uses it.

You can do the EXISTS() test in DSQL inside a WHERE clause, e.g.
SELECT.....

WHERE EXISTS(SELECT 1 FROM MyTable)

So to test whether MyTable is empty you could just create a bare DSQL
select statement that returns something, e.g
select '1' from rdb$database where exists(select 1 from MyTable)

heLen