1

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

mustaccio
  • 18,234
  • 16
  • 48
  • 57
youngfolks
  • 11
  • 1
  • 2
  • 1
    You'll have to execute one select statement for each table in the Sample schema. (Some kind of dynamic/script solution probably.) – jarlh Mar 27 '15 at 14:57
  • Could you please raise example some dynamic/script please ? – youngfolks Mar 28 '15 at 10:13
  • If your table statistics are up-to-date, it looks like this [might be in the syscat tables already](http://stackoverflow.com/a/5705139/812837). Otherwise, yes you need a dynamic statement; [this looks like a good starting point](http://stackoverflow.com/q/27441641/812837). What do you want this information for? – Clockwork-Muse Mar 29 '15 at 03:50

1 Answers1

1

Try this:

Select TABLE_SCHEMA, TABLE_NAME, NUMBER_ROWS from qsys2.systablestat
Where TABLE_NAME = 'Sample'
vahdet
  • 6,357
  • 9
  • 51
  • 106