首页 > 其他 > 详细

查询表空间大小

时间:2018-05-27 17:30:33      阅读:208      评论:0      收藏:0      [点我收藏+]
--查询表空间大小
declare @name varchar(1000)
declare @sql varchar(1000)
if object_id(tempdb..#space) is not null drop table #space 
create table #space(name varchar(50),rows bigint,reserved varchar(12),data varchar(12),index_size varchar(12),unused varchar(12))
declare sp cursor local for select [+name+] from sysobjects where type = u
open sp
fetch sp into @name
while @@fetch_status = 0
begin
set @sql = insert into #space exec sp_spaceused  + @name
exec(@sql)
fetch sp into @name
end
close sp
select * from #space order by cast(replace(reserved,kb,‘‘)as int) desc

 

查询表空间大小

原文:https://www.cnblogs.com/binghou/p/9096629.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!