SQL查询数据库中所有表的记录条数

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

 

转载自http://blog.csdn.net/yuanhong55/article/details/14434477

posted @ 2017-08-11 16:51  samnoah  阅读(125)  评论(0)    收藏  举报