|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/5/2008 10:50:05 AM
Posts: 7,
Visits: 25
|
|
Hi I have bunch of tables collected from a database and tabulated them in a table
Could you please let me know what is best sql or method to get record counts
on each table in the table i created and listed them
thanks
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 9/6/2008 8:42:44 AM
Posts: 41,
Visits: 93
|
|
Follow this steps :
step 1: create table table2 (tablename varchar(50),cnt integer)
step 2 :
select k.x from (
Select substr('''',1,1)||a.tablename||substr('''',1,1) c, a.tablename q, ',count(*) from '||q p,'insert into table2 select'||' '||c||p||';' x
From
(
Select Distinct Trim(databasename)||'.'||Trim(tablename) tablename
From dbc.tables
Where tablekind='T') a
) k
step 3: run this result set in one shot.
Here I have taken example of all the database table u can modify u'r query accordingly.
Regards,
Subhash
Regards,
Subhash
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/5/2008 10:50:05 AM
Posts: 7,
Visits: 25
|
|
Hi Subash:
Thankyou so much for ur wonderful reply. really appreciate that
But my database is teradata
I guess substr is not working on teradata
any improvements in query to work well in teradata?
Thanks
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 9/6/2008 8:42:44 AM
Posts: 41,
Visits: 93
|
|
hi dear
I have designed this in TD itself...........
And substr will work in TD as well
Subhash
Regards,
Subhash
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/5/2008 10:50:05 AM
Posts: 7,
Visits: 25
|
|
Hi subhash:
I am trying to execute your query
but I am getting 3807 error saying
database does not exist
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 9/6/2008 8:42:44 AM
Posts: 41,
Visits: 93
|
|
depends from which user u are executing..............
might be possible u don't have access on this schema because this is sys schema
dbc is default schema for Teradata....
it should run....
Regards,
Subhash
Regards,
Subhash
|
|
|
|