Archives of the TeradataForum
Message Posted: Tue, 07 May 2002 @ 12:23:38 GMT
A very quick, dirty and ugly solution :-) and I can not recommend to use it against the whole production database.
First: generate SQL with the SQL below and export it to a file (adjust the database list)
Second: execute the generated SQL.
select (case when id1 <> 1 then 'union all ' else '' end) !! /* first table no union */ sql !! (case when id2 <> 1 then '' else ';' end) as sql /* last table ; */ from ( select csum(1,tablename) as id1, /* first table */ csum(1,tablename desc) as id2, /* last table */ 'select cast(''' !! trim(databasename) !! ''' as varchar(30)) as databasename, cast(''' !! trim(tablename) !! ''' as varchar(30)) as tablename, count(*) as rowcount from '!! trim(databasename) !! '.'!! trim(tablename) !! ' group by 1' as sql from dbc.tables where databasename in ('X','Y') and tablekind = 'T' ) as tmp order by id1 ;
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|