sql server 2008 查询所有表的记录数

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

DROP TABLE #temp;

posted @ 2016-03-29 16:28  怪先生  阅读(467)  评论(0编辑  收藏  举报