Re: Get a COUNT(*) for all tables in a schema? ChrisC wrote:
> --CELKO-- wrote:
>> Is there a simple way to get a COUNT(*) for all tables in a schema in
>> DB2 LUW 9.0?
>
> Well, if the tables are mostly static and you have current statistics
> OR your tables are very dynamic and you have sufficiently recent
> statistics, selecting from the catalog works great:
>
> select tabname, card from syscat.tables where tabschema =
> '<schemaName>'
>
> (noting that for very dynamic table sizes, the exact COUNT(*) isn't
> often accurate in any case for long).
.... otherwise you need to scribble up a stored proc with dynamic SQL
inside..
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab |