Subject Re: [firebird-support] Fastest way to query tables and views and return no records.
Author Alexandre Benson Smith
esbreidenbach wrote:
> Hi,
> I have a routine I use in my application which runs a separate query
> on every table and view in the database. The purpose of these queries
> is really just to obtain the field definitions of the underlying
> table, not to return any actual data.
> The routine uses the following generic SQL:
> Select * from TableName/ViewName where 1 = 0;
> My problem is that these queries can run very slowly on views which
> are really meant to have additional where clause statements, and even
> on tables with large numbers of records. The intention of the where
> clause "where 1 = 0" was to eliminate any query activity, but it is
> not working out this way.
> Is there a query which I can execute that will run very fast (and
> return no data), or any other ideas on how to do what I want?
> Thanks,

You could only prepare it, but if you really want to execute a query.

you coudl try

select first 0 * from YourTable

see you !

Alexandre Benson Smith
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil