查看数据库中每个表的空间使用情况

create table test(
name varchar(50),
rows int,
reserved varchar(20),
data varchar(20),
index_size varchar(20),
unused varchar(20)
)

set nocount on
insert into test
EXEC sp_MSforeachtable @command1="sp_spaceused '?'"

select * from test order by cast(replace(reserved,'KB','') as int) desc

drop table test 

posted on 2007-07-03 11:44  HTTP500  阅读(102)  评论(0编辑  收藏  举报