Need to look at all the tables and their sizes for a database. Is there a DMV that I can use to accomplish this task?
asked Apr 30, 2012 at 02:39 PM in Default
Right click a database, choose reports, then 'Disk usage by Table'. This will give you a report that details for each table, the number of rows and how much disk space is taken up by the table (separated out as data + indexes).
If you need to add any more info, or tweak it slightly, capture the SQL that the report uses to generate the data, and build your own table reporting query.
answered Apr 30, 2012 at 02:47 PM
Kev Riley ♦♦
You can do something like this:
Modified to show the size of the used pages. Borrowed from here: http://www.dbforums.com/microsoft-sql-server/1003535-query-showing-tablesize-mb.html
This should work in SQL 2005 & SQL 2008.
Hope this helps!!
answered Apr 30, 2012 at 02:49 PM
Yes, there is a dmv. You can use dm_db_partition_stats (details) to get this information:
answered May 01, 2012 at 08:10 AM