Finding size of Table/Indexes in SQL
This is an question that came up in the newsgroups to
how fo we find the size of tables and indexes in the new version of SQL Server
The solution to the same was using some of the DMVs (Dynamic Management Views)
that have statistical information of objects. And for this case we
use CTE's too that got introduced in SQL Server 2005.
The outout of the same would list all the tables and indexes
with the size they occupy. As said earlier we use the sys.dm_db_partition_stats
to query and get the data. This data used to be in sysindexes earlier.
Download the sql file