文章分类

相关文章

SQLServer 统计数据表记录数空间占用

分类:数据库 SQLServer     发布:2017-10-10     来源:本站     浏览:1110 次
CREATE TABLE _tmp
    (
      NAME VARCHAR(50) ,
      ROWS INT ,
      reserved VARCHAR(50) ,
      DATA VARCHAR(50) ,
      index_size VARCHAR(50) ,
      unused VARCHAR(50)
    );
INSERT  INTO _tmp
        ( NAME ,
          ROWS ,
          reserved ,
          DATA ,
          index_size ,
          unused
        )
        EXEC sp_MSforeachtable @command1 = "sp_spaceused '?'";
SELECT  NAME AS '表名' ,
        [ROWS] AS '记录数' ,
        reserved AS '占用空间' ,
        DATA AS '数据大小' ,
        index_size AS '索引大小' ,
        unused AS '未使用空间'
FROM    _tmp
WHERE   NAME <> '_tmp'
ORDER BY ROWS DESC
       
DROP TABLE _tmp

上一篇:电烙铁的焊接方法图解

下一篇:APS.NET MVC 对输出HTML源码进行压缩