Reputation: 2597
How to find what the physical size of table in MS Sql 2005? Is it possible using sql query or not? Thanks.
Upvotes: 16
Views: 16159
Reputation: 180
You can also use the built-in report (in 2008 at least).
Right-click the database in MS-SMS then select Reports > Standard Reports > Disk Usage by Table from the context menu.
The results are exportable to Excel.
Upvotes: 10
Reputation: 4117
Try the stored procedure:
exec sp_spaceused TableName
For all tables you could use:
exec sp_Msforeachtable 'exec sp_spaceused ''?'''
Upvotes: 30
Reputation: 79
SELECT table_schema, table_name, ROUND(data_length/1024/1024,2) total_size_mb FROM information_schema.tables WHERE table_name = 'emp_master' AND table_schema = 'emp_database';
Upvotes: 0
Reputation: 147224
You can use the sp_spaceused system procedure:
EXECUTE sp_spaceused 'YourTable'
Upvotes: 3