View Single Post

   
  #4 (permalink)  
Old 05-02-2008, 05:04 AM
Lennart
 
Posts: n/a
Default Re: Get a COUNT(*) for all tables in a schema?

On Apr 30, 6:41 pm, --CELKO-- <jcelko...@earthlink.net> wrote:
> Is there a simple way to get a COUNT(*) for all tables in a schema in
> DB2 LUW 9.0?


Depends on what you mean by simple, but it is pretty straightforward
to do it from a shell.

[lelle@53dbd181 Documents]$ for t in `db2 -x "select tabname from
syscat.tables where tabschema = 'LELLE' and type = 'T'"`; do db2
"select '$t', count(1) from lelle.$t"; done

1 2
-- -----------
T1 196608

1 record(s) selected.


1 2
---------------- -----------
EXPLAIN_INSTANCE 10

1 record(s) selected.


1 2
----------------- -----------
EXPLAIN_STATEMENT 20

1 record(s) selected.

[...]

/Lennart
Reply With Quote