一次性查看某数据库的所有表大小
一次性查看某数据库的所有表大小:
create table test(
name varchar(50),
rows int,
reserved varchar(20),
data varchar(20),
index_size varchar(20),
unused varchar(20)
)
insert into test
exec sp_MSforeachtable "exec sp_spaceused '?'"
select * from test order by cast(replace(reserved,'KB','') as int) desc