Subject RE: [firebird-support] SELECT COUNT(*) FROM :PARAMTABLE
Author Alan McDonald
> I want to get the database statistics. I have 20 Tables and I
> want to get the record counts of tables
> I tried to get the tablenames from rdb$xxxxxx but I couldnot
> find. Is there a way to do this?

Well first of all you will find the table names in this query
SELECT RDB$RELATION_NAME FROM RDB$RELATIONS
WHERE RDB$RELATION_NAME NOT LIKE 'RDB$%'

>
> And,
>
> SELECT COUNT(*) FROM :PARAMTABLE
>
> This Query is not working. Is there a way to write a SP for this?
>

Secondly, FB does not accept DDL objects as parameters so, no, this query
will not work. But you can use execute statement command to do this.

Third, yes you can write a an SP to do this too.

Finally, please forgive me but I hope you don't intend to use this command
fruently in your application becuase you willnot be satisfied with the speed
of execution at all.

We often see this coming from people who move from destop databases where
they rely on record numbers a lot. In SQL dbs we do not rely on this as part
of operations.
Alan