我需要从db2
数据库中选择所有表行计数。
我有一个查询来选择所有模式和表名:
select rtrim(tabschema)||'.'||rtrim(tabname) as tableName from syscat.tables where tabschema = 'COM' order by tabname;
此查询为我提供了数据库表名称的列表。
我想做类似的事情:
select count(*) from tableFromTheFirstQuery
tableFromThePreviousQuery由我的第一个查询的tableName代替。
我不能喜欢
select count(*) from (select rtrim(tabschema)||'.'||rtrim(tabname) as tableName from syscat.tables where tabschema = 'COM' order by tabname);
我只会得到第一个查询的计数结果。
我不确定这种方式是否存在。基本上,在执行DR活动之前,我需要将所有表行计数保存在文本文件中。
请告知