All Forums Database
nguyent02 8 posts Joined 03/07
02 Mar 2007
How to count total row count for each table in entire database

Hi, My Name is T-Nguyen, a new bee for teradata. Using SQL assistance.Any one able to help me with SQL to find out how many row for each table in the database. i am so tire to do simple count SQl for each table. Appreciated so much

Koentje 23 posts Joined 09/04
02 Mar 2007

Hi,when I want to count,I generate a query by using following SQL:Select 'Select ''' || Database_Id || ''', ''' || Name || ' '', Count(*) From ' || Trim(Database_Id) || '.' || Trim(Name) || ' Union'From (Select DatabaseName, TableName From dbc.tables where databasename like 'PRD_%' and tablekind = 'T' Group by 1, 2 ) As Counting(Database_Id, Name);--> Just change the databasename (here everything that starts with PRD_)--> Cut and paste the result of this query (delete the last Union of the last row)--> Executes the 'result'

You must sign in to leave a comment.