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 TableName
DROP TABLE #temp

posted @ 2014-04-25 17:41  FH1004322  阅读(400)  评论(0编辑  收藏  举报