查询SQL SERVER所有表记录数和体积大小
来源:互联网 发布:中医网络教育本科 编辑:程序博客网 时间:2024/05/18 01:42
declare aaa cursor for
select table_name from information_schema.tables WHERE TABLE_type='BASE TABLE' order by table_name
open aaa
declare @tb varchar(255)
fetch next from aaa into @tb
while @@fetch_status=0
begin
exec(' select '+''''+@tb+''''+' TBNM,(select count(*) from '+@tb+' ) cnt,ltrim(str(sum(reserved) * (select d.low from master.dbo.spt_values d where d.number = 1 and d.type = ''E'') / 1024.,15,0) +'' '' + ''KB'') '
+' +''/''+ ltrim(str(sum(used) * (select d.low from master.dbo.spt_values d where d.number = 1 and d.type = ''E'') / 1024.,15,0) +'' '' + ''KB'') used '
+' from sysindexes
where indid in (0, 1, 255)
and id = (select id from sysobjects
where id = object_id('+''''+@tb+''''+')) ')
fetch next from aaa into @tb
end
close aaa
deallocate aaa
select table_name from information_schema.tables WHERE TABLE_type='BASE TABLE' order by table_name
open aaa
declare @tb varchar(255)
fetch next from aaa into @tb
while @@fetch_status=0
begin
exec(' select '+''''+@tb+''''+' TBNM,(select count(*) from '+@tb+' ) cnt,ltrim(str(sum(reserved) * (select d.low from master.dbo.spt_values d where d.number = 1 and d.type = ''E'') / 1024.,15,0) +'' '' + ''KB'') '
+' +''/''+ ltrim(str(sum(used) * (select d.low from master.dbo.spt_values d where d.number = 1 and d.type = ''E'') / 1024.,15,0) +'' '' + ''KB'') used '
+' from sysindexes
where indid in (0, 1, 255)
and id = (select id from sysobjects
where id = object_id('+''''+@tb+''''+')) ')
fetch next from aaa into @tb
end
close aaa
deallocate aaa
- 查询SQL SERVER所有表记录数和体积大小
- SQL查询所有用户表记录数
- SQL查询所有用户表记录数
- sql server 获取数据库所有表记录数的方法
- MS SQL Server 获得所有表的表记录,和使用空间的SQL
- Atitit.mssql 数据库表记录数and 表体积大小统计
- 清空 sql server 数据库所有的表记录
- SQL Server 统计一个数据库中各表记录数
- 查sql表记录数
- oracle中所有表记录数统计
- SQLServer中统计所有表记录数
- oracle查询用户全部表记录数
- SQLServer数据库表记录查询sql
- 树形结构表记录 :sql递归查询
- SQL Server 文档整理 - 2 清空所有数据库表记录的存储过程
- 大数据量下快速获取 SQL Server 数据库表记录数的方法
- 大数据量下快速获取 SQL Server 数据库表记录数的方法
- Sql Server按树形结构排序查询表记录(CSDN论坛转载)
- NetBeans IDE 6.1 无法使用上下文帮助API的解决办法~
- 为什么邮箱进不去啦?
- 国内软件业发展中存在的问题
- MathTool.java
- 浅谈程序员的数学修养
- 查询SQL SERVER所有表记录数和体积大小
- c# ref参数的用法 out参数
- 哀悼四川汶川大地震死难同胞,网站整体变灰色的方法
- Struts2国际化
- 本人写的手机狗(防盗软件)欢迎下载
- TestVarargs.java
- C++与matlab混合编程基于主成份分析算法的数值分析(一)
- Delphi之祭
- 中小企业IT建设的小看法2