Getting All Table Information

One thing that bugs me in SQL Server is how hard it is to get information about your tables to analyse usage, indexes and size. This is a query I wrote several years ago and still use today. Information exported includes: All Index information including columns Compression File Groups Space Used Row Count Index Usage SELECT O.object_id, O.name TableName, ISNULL(I.[name],'HEAP') IndexName, i.type_desc [IndexType], ISNULL(SDS.name,NPSDS.[name]) FileGroup, PS.row_count [RowCount], CAST(PS.used_page_count * 8 AS money)/1024 SpaceUsed_MB, CAST(PS. [Read More]