sql server 统计每张表所占用的空间.sql

 declare tables cursor for select name from sysobjects where xtype = ‘U’;

declare @table nvarchar(255);
open tables 
fetch next FROM tables into @table
while @@fetch_status = 0
begin
exec sp_spaceused  @table;
fetch next FROM tables into @table
end 
 
close tables;
DEALLOCATE tables;

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注