Solved

Get a list of all tables from a database and their respective size in MB

Posted on 2008-10-03
3
243 Views
Last Modified: 2012-05-05
How to list all tables of a SQL Server database and their respective size in MB?

Thanks,

Felipe
0
Comment
Question by:Carlos_Felipe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 22637425
you can use sp_spaceused
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22637530

create table #t(tablename nvarchar(255), rows int, reserved nvarchar(255), data nvarchar(255), index_size nvarchar(255), unused nvarchar(255))

insert into #t
exec sp_msforeachtable 'exec sp_spaceused [?]'

select * from #t
order by rows desc
0
 

Author Comment

by:Carlos_Felipe
ID: 22638588
It works!

Thanks!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question