Home > Archive > MS SQL Server > November 2006 > How to list all tables and their size









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to list all tables and their size
Zack

2006-11-15, 7:14 pm

Is there a stored procedure to list all tables and their size, and / or
number of rows
Is there a stored procedure to list all indexes and their size


Edgardo Valdez, MCTS, MCITP, MCSD, MCDBA

2006-11-15, 7:14 pm

Check this link:

How do I get a list of SQL Server tables and their row counts?
http://sqlserver2000.databases.aspf...row-counts.html

"Zack" wrote:

> Is there a stored procedure to list all tables and their size, and / or
> number of rows
> Is there a stored procedure to list all indexes and their size
>
>
>

Greg Linwood

2006-11-16, 12:16 am

The final solution in that article uses DBCC UPDATEUSAGE(0). This is fine,
but here are two further suggestions you might want to take into
consideration:

a) DBCC UPDATEUSAGE(0) updates sysindexes for all indexes on all tables in a
database. This can take a long time on a large production database & lead to
major performance degradation if used during peak processing periods. Just
make sure you schedule this for periods of low activity or keep a close eye
on the server whilst its running if users are using the database at the
time.

b) DBCC UPDATEUSAGE(0) alone doesn't update the rowcount for each table -
you have to add the additional "with count_rows" option if you want an
update of how many rows are in the table. Keep in mind that this figure will
always be slightly out of date on a busy server thoug. I generally don't use
it, but it's worth knowing all the same

Regards,
Greg Linwood
SQL Server MVP
http://blogs.sqlserver.org.au/blogs/greg_linwood

"Edgardo Valdez, MCTS, MCITP, MCSD, MCDBA"
< EdgardoValdezMCTSMCI
TPMCSDMCDBA@discussi
ons.microsoft.com> wrote in message
news:57C92A87-D9DE-46AE-A45C- 39D1DF9A272E@microso
ft.com...[color=darkred]
> Check this link:
>
> How do I get a list of SQL Server tables and their row counts?
> http://sqlserver2000.databases.aspf...row-counts.html
>
> "Zack" wrote:
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com