查询数据库中所有表的大小,哪些表的数据量较大
create table #t
(name varchar(255), rows bigint, reserved varchar(20), data varchar(20), index_size varchar(20), unused varchar(20)) exec sp_MSforeachtable "insert into #t exec sp_spaceused '?'" select SUBSTRING(t.reserved, 0, CHARINDEX('KB', t.reserved)-1), *
from #t t
order by cast(SUBSTRING(t.reserved, 0, CHARINDEX('KB', t.reserved)-1) as int) desc drop table #t