I would like to count records in all tables in the

2019-08-13 07:50发布

问题:

I try this statement

select schema_name , tabs_name ,
('select count(*) from' || schema_name ||'.'|| tabs_name)
from sysibm.systables
where schema_name = 'Sample'

I would like in the string type can be execute string or must be create procedure or any?

'select count(*) from' || schema_name ||'.'|| tabs_name

Thank you in advance from Thailand

回答1:

Try this:

Select TABLE_SCHEMA, TABLE_NAME, NUMBER_ROWS from qsys2.systablestat
Where TABLE_NAME = 'Sample'