SQL SERVER sql语句计算表占用空间大小
程序员文章站
2022-04-20 14:49:10
...
declare @table_spaceused table
(name nvarchar(100)
,rows int
,reserved nvarchar(100)
,data nvarchar(100)
,index_size nvarchar(100)
,unused nvarchar(100)
)
insert into @table_spaceused
(name,rows,reserved,data,index_size,unused )
exec sp_MSforeachtable
@command1='exec sp_spaceused ''?'''
select * from @table_spaceused
推荐阅读