统计SqlServer每张表内的数据量

CREATE TABLE #temp (TableName VARCHAR (255), RowCnt INT)
EXEC sp_MSforeachtable 'INSERT INTO #temp SELECT ''?'', COUNT(*) FROM ?'
SELECT TableName, RowCnt FROM #temp ORDER BY RowCnt DESC
DROP TABLE #temp

posted @ 2016-03-05 19:16  草莓爸  阅读(657)  评论(0编辑  收藏  举报