I have a group of about 30 tables, and I want to know the physical size on disk of all of these tables (plus indexes).
Is there an easier way of doing this than through the GUI in SQL server 2008 R2?
sql serversql-server-2008
I have a group of about 30 tables, and I want to know the physical size on disk of all of these tables (plus indexes).
Is there an easier way of doing this than through the GUI in SQL server 2008 R2?
Best Answer
If you are looking to get the size information for all tables in the database you can use this query:
It returns the reserved megabytes and the used megabytes as well as the row count for every index in the database. The first column tells you the object type. This includes system_tables as well as indexed views. If you want a subset, filter on that column.
If you do not need the per-index detail you can use this query instead:
It gives the same information, but on an object basis. Again, filter on the object type if you are for example not interested in system_tables.
If you are just interested in normal tables, you can get the information in SSMS too by using the "Object Explorer Details" tab:
You can open it by selecting the table folder in the database in Object Explorer and then pressing
F7
.You might have to add the size columns. For that just right-click on the column list and select the columns you want to see: