Home About Us SQL Interview Book Contact Us RSS
Articles
Tools
Code Snippets
Links
Tips & Tricks
FAQ
Resources
Articles
Code Snippets
Links
FAQ
Resources

Saravana Kumar
Vinod Kumar


Finding size of Table/Indexes in SQL Server 2005

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 2005. 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