You are here: Count all records in all tables « MsSQL Server « IT news, forums, messages
Count all records in all tables

Posted by cypisek on 04/13/06 18:00

I need some help with this. I was able to count all the records in our
database using the user_tables and user_tab_columns tables after
refreshing the statistics on this database.
We are doing an upgrade of a system and I will not be able to refresh
the statistics during the upgrade. I need more of a manual process of
running these queries.

Now I do:
select A.table_name, round(A.num_rows,0) as rowcount,
count(b.table_name) as ColumnCount
from dba_tables A, dba_tab_columns B
where A.table_name = B.table_name and A.owner in ('PS','SYSADM')
group by A.table_name, A.num_rows
order by rowcount desc, columncount desc

But I can't use the num_rows anymore so I was thinking more to do this:

Select A.table_name from
(select count(*) from A.Table_name B where A.Table_name =
B.Table_Name)
from user_table

This does not work for me since I don't know how to pass the table_name
from the first select to the second select. The logic is there but the
syntax is not.
Please help.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация