如何查看数据库中表占用的磁盘空间

CREATE TABLE tb_SpaceInfoTable
(
   ID int identity(1,1),
   name sysname,
   rows char(11),
   reserved varchar(18),
   data varchar(18),
   index_size varchar(18),
   unused varchar(18)
)
GO

EXEC SP_MSFOREACHTABLE
@COMMAND1 = 'INSERT INTO tb_SpaceInfoTable(name,
                                           rows,
                                           reserved,
                                           data,
                                           index_size,
                                           unused)
              EXEC SP_SPACEUSED ''?'''
GO

SELECT * FROM tb_SpaceInfoTable
GO 

阅读更多
换一批

没有更多推荐了,返回首页