LEFT OUTER JOIN sys.schemas s ON t.schema_id = s.schema_idĪnother way is using the stored procedure sp_spaceused which displays the number of rows, disk space reserved, and disk space used by a table, indexed view, or Service Broker queue in the current database, or displays the disk space reserved and used by the whole database. INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id INNER JOIN sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_id INNER JOIN sys.indexes i ON t.object_id = i.object_id (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB To get a rough view of how many rows, total, used and unused space each table has, in a sql server database you can run the following query:
0 Comments
Leave a Reply. |