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?thanks!
asked Apr 30 '12 at 02:39 PM in Default
Yes, there is a dmv. You can use dm_db_partition_stats ([details]) to get this information:
: h ttp://msdn.microsoft.com/en-us/library/ms187737.aspx
answered May 01 '12 at 08:10 AM
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 '12 at 02:49 PM
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 '12 at 02:47 PM
Kev Riley ♦♦