查询表空间大小
Posted 自来云
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了查询表空间大小相关的知识,希望对你有一定的参考价值。
--查询表空间大小 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
以上是关于查询表空间大小的主要内容,如果未能解决你的问题,请参考以下文章