一个表占用了多少磁盘空间的查询方法
2010-04-08 09:42
417 查看
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:1;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:"/@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:宋体;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
exec
sp_MSForEachTable
@precommand=
N'
create table ##(
表名
sysname,
记录数
int,
保留空间
Nvarchar(10),
使用空间
varchar(10),
索引使用空间
varchar(10),
未用空间
varchar(10))'
,
@command1=
N'insert ## exec
sp_spaceused ''?'''
,
@postcommand=
N'select * from ## order by
记录数
'
DROP
TABLE
##
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:1;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:"/@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:宋体;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
exec
sp_MSForEachTable
@precommand=
N'
create table ##(
表名
sysname,
记录数
int,
保留空间
Nvarchar(10),
使用空间
varchar(10),
索引使用空间
varchar(10),
未用空间
varchar(10))'
,
@command1=
N'insert ## exec
sp_spaceused ''?'''
,
@postcommand=
N'select * from ## order by
记录数
'
DROP
TABLE
##
相关文章推荐
- SQL查询某数据库各表占用磁盘空间和收缩数据库MDF文件
- linux mysql-bin.000001占用磁盘空间过大解决方法
- Linux查找系统中占用磁盘空间最大的文件的几种方法
- MySQL数据库查询数据库及各个表所占磁盘空间大小的方法
- linux下使用 du查看某个文件或目录占用磁盘空间的大小方法
- 使用一个T-SQL语句批量查询数据表占用空间及其行数
- linux mysql-bin.000001占用磁盘空间过大解决方法
- 查询一个ip上有多少个网站的方法
- Linux系统上给文件按占用磁盘空间大小排序的方法
- MySQL中查询所有数据库占用磁盘空间大小和单个库中所有表的大小的sql语句
- linux mysql-bin.000001占用磁盘空间过大解决方法
- centos mysql占用磁盘空间过大解决方法
- 使用一个T-SQL语句批量查询数据表占用空间及其行数
- 一个查询数据库中所有表的空间占用情况的存储过程
- linux下使用 du查看某个文件或目录占用磁盘空间的大小方法
- sql查询数据库中所有表的记录条数,以及占用磁盘空间大小。
- 查询数据库中每个表占用空间方法
- 关于 Android Studio 2.x 工程占用空间大的一个解决方法
- MS SQL Server 2000中查询数据库每个表占用磁盘空间情况