Sql Server 查询库表记录数

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

 

posted @ 2014-05-06 09:35  tohen  阅读(218)  评论(0编辑  收藏  举报