Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 rows & spaced used by each table

Author  Topic 

chris_wood99
Yak Posting Veteran

70 Posts

Posted - 2005-07-07 : 07:12:56
Has anyone got a stored procedure that lists all the tables in a db and the number of rows and space consumed?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-07-07 : 07:17:57
Tim has a script here:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49419

There's also:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50993

You can view the text of sp_spaceused to see how they calculate space and modify it to suit your needs (that's what I did).
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-07 : 07:18:40
sp_spaceused 'tablename' will show you table space details
For getting number of rows use select count(*)
Otherwise you need to look for sysindexes table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -