Physical size of MS SQL Table
How to find what the physical size of table in MS开发者_开发问答 Sql 2005? Is it possible using sql query or not? Thanks.
Try the stored procedure:
exec sp_spaceused TableName
For all tables you could use:
exec sp_Msforeachtable 'exec sp_spaceused ''?'''
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.
You can use the sp_spaceused system procedure:
EXECUTE sp_spaceused 'YourTable'
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';
精彩评论