Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 07 May 2002 @ 12:28:57 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: SQL to get table name with row counts?
 
From:   Claybourne L. Barrineau

Rohit,

Execute the following SQL:

Create Volatile Table Table_Row_Count
(
Tablename VarChar(30)
,RowCount Integer
)
On Commit Preserve Rows;

Select    'Insert into Table_Row_Count Select ' || '''' ||
trim(tablename)
|| ''',' || ' Count(*) From ' || trim(databasename) || '.' ||
trim(tablename) || ';' (Title '')
From dbc.tables
Where     databasename   =    '???'
and  tablename like '???';

You will need to execute the Answer set (SQL) created from the above SQL. If you are using Queryman, then all you need to do is copy the answer and paste it in the Queryman execution windiw, then execute. If you are using BTEQ, you will need to export the answer set to a file, then execute the file. Note, because this is a volatile table, the table will disappear if you close your session. You may want to create a permanent table instead (particularly if you want stats on this table.)


Hope this helps,

Claybourne Barrineau



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023