Space Used by Tables in a Database in SQL
In order to know which table is using maximum space or How much space each table is using in a Database
so for this SQL Procedures are there
In order to check space used by a single table
--Space Used by Single Table in Database
USE Database_Name
EXEC sp_spaceused 'Employee';
Output
name rows reserved data index_size unused
Employee 7 16 KB 8 KB 8 KB 0 KB
--Space Used by All Table in Database
USE Database_Name;
EXEC sp_msforeachtable 'EXEC sp_spaceused [?]'
Output
All tables of Database with there size
name rows reserved data index_size unused
Employee 7 16 KB 8 KB 8 KB 0 KB
name rows reserved data index_size unused
Employee1 7 16 KB 8 KB 8 KB 0 KB
name rows reserved data index_size unused
Employee2 7 16 KB 8 KB 8 KB 0 KB
No comments:
Post a Comment