PostRank

2009/12/14

[轉載]用 SQL 取得各 Tables 資料筆數

 
用 SQL 取得各 Tables 資料筆數,
特將結果分享如下 :

Sybase :
select O.name,rowcnt(I.doampg) RecCnt from sysobjects O,sysindexes I
where I.id=O.id and I.indid=1 and O.type='U'


MSSQL :
select O.name,I.rowcnt from sysobjects O,sysindexes I
where I.id=O.id and I.indid=1 and O.type='U'
Oracle :

A. Compute statistics collection :
    1. use table characterics :
    create table with 'monitoring' option. and using PL/SQL
    "analyze table [TableName] compute statistics;

    2. use dbms_stats packages :
    EXECUTE dbms_stats.gather_schema_stats (user);
    EXECUTE dbms_stats.gather_table_stats (user,'[TableName]');

B. Get Number of rows from all_tables view.
    select table_name,num_rows from all_tables where owner=user;


 

1 則留言:

匿名 提到...

非常好东西。