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

How to list all tables of a SQL Server database and their respective size in MB?

Thanks,

Felipe
Carlos_FelipeAsked:
Who is Participating?
 
chapmandewCommented:

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
 
momi_sabagCommented:
you can use sp_spaceused
0
 
Carlos_FelipeAuthor Commented:
It works!

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.