sqlserver查询所有表的行数的sql语句
2012-01-11 16:22
405 查看
select a.name, b.rows
from sysobjects a
inner join sysindexes b on a.id = b.id
where a.type = 'u'
and b.indid in (0, 1)
order by a.name
SELECT o.name AS "Table Name", i.rowcnt AS "Row Count"
FROM sysobjects o, sysindexes i
WHERE i.id = o.id
AND i.indid IN(0,1)
AND o.xtype = 'u' --只统计用户表
AND o.name <> 'sysdiagrams'
ORDER BY i.rowcnt DESC --按行排降序
COMPUTE SUM(i.rowcnt), count(o.name); --汇总行数,表数
GO
from sysobjects a
inner join sysindexes b on a.id = b.id
where a.type = 'u'
and b.indid in (0, 1)
order by a.name
SELECT o.name AS "Table Name", i.rowcnt AS "Row Count"
FROM sysobjects o, sysindexes i
WHERE i.id = o.id
AND i.indid IN(0,1)
AND o.xtype = 'u' --只统计用户表
AND o.name <> 'sysdiagrams'
ORDER BY i.rowcnt DESC --按行排降序
COMPUTE SUM(i.rowcnt), count(o.name); --汇总行数,表数
GO
相关文章推荐
- sqlserver查询所有表的行数的sql语句
- SQLServer中查询表结构(表主键 、列说明、列数据类型、所有表名)的Sql语句
- SqlServer 查询某数据库下的所有表的物理空间和行数 语句和存储过程
- SQLServer中查询表结构(表主键 、列说明、列数据类型、所有表名)的Sql语句
- SQLServer中查询表结构(表主键 、列说明、列数据类型、所有表名)的Sql语句
- 使用SQL语句查询MySQL,SQLServer,Oracle所有数据库名和表名,字段名
- 利用SQL语句查询一个数据库中的所有表
- 用SQL语句查询出所有表的表结构(字段定义,类型,长度等),导出CSV(SQL2008 R2)
- sqlserver查询数据的所有表名和行数
- SQL 查询某个库的所有表的行数
- 查询数据库中所有表的行数(sqlserver 2000)
- SQL语句查询表中的所有约束
- [转]查询sqlserver 正在执行的sql语句的详细信息
- (转)SQLServer_T-SQL 语句执行时间的查询
- SQLServer中用T―SQL命令查询一个数据库中有哪些表的sql语句
- 查询SQLServer 服务器,执行过的SQL语句耗时!
- sqlserver查询数据的所有表名和行数
- 一只查询SQLServer 2005所有信息的语句
- 一条sql语句统计所有表的行数
- 【SQL精彩语句】SQL SERVER 2000中查询指定节点及其所有子节点的函数(表格形式显示)