DB2,查询现有库中的所有表及表中数据记录条数

DB2数据库,查询库中全部表及各表数据总条数,方法是使用DB2的系统表

1)sysibm.systables表

select name,card 
from sysibm.systables 
where type='T' and creator='DB2ADMIN';

name:表名
card:记录总行数, total number of rows;-1 if statistics are not collected.
type: 查询表用 T,查询视图用 V
createor:用户

2)syscat.tables表

select tabname,card  
from syscat.tables 
where tabschema='ODSF'

tabname:表名
card:总行数
tabschema:模式/架构

遗留问题:1.系统表表结构中字段含义,及这两张表之间的差异;2.其他系统表

你可能感兴趣的:(#,DB2数据库开发,sql,db2)