Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-03
3
Medium Priority
?
250 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 2000 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

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

722 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