Heim >Datenbank >MySQL-Tutorial >Atitit.mssql数据库表记录数and表体积大小统计

Atitit.mssql数据库表记录数and表体积大小统计

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 16:05:201205Durchsuche

Atitit.mssql 数据库表记录数and 表体积大小统计 1. EXEC sp_MSforeachtable EXECUTE sp_spaceused ? 最后一种方法是利用隐藏未公开的系统存储过程sp_MSforeachtable CREATE TABLE #temp (TableName VARCHAR (255), RowCnt INT) EXEC sp_MSforeachtable INSE

Atitit.mssql 数据库表记录数and 表体积大小统计

1. EXEC sp_MSforeachtable "EXECUTE sp_spaceused '?'"

最后一种方法是利用隐藏未公开的系统存储过程sp_MSforeachtable

CREATE TABLE #temp (TableName VARCHAR (255), RowCnt INT)

EXEC sp_MSforeachtable 'INSERT INTO #temp SELECT ''?'', COUNT(*) FROM ?'

SELECT TableName, RowCnt FROM #temp ORDER BY TableName

DROP TABLE #temp

从mssql6.5开始,微软提供了两个不公开,非常有用的系统存储过程sp_MSforeachtable和sp_MSforeachdb,用于遍历某个数据库的每个表和遍历DBMS管理下的每个数据库。

作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com

转载请注明来源: http://blog.csdn.net/attilax

2. 查询首先通过sysobjects表

3. 参考

SQLSERVER中统计所有表的记录数 - minisunny的专栏 - 博客频道 - CSDN.NET.htm

我要啦免费统计
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn