Sql server 2005 查询某个数据库下的所有表的记录行数

 Sql server 2005 查询某个数据库下的所有表的记录行数


select a.name AS name,b.rows AS rows  INTO #Temp1
from db_tank.dbo.sysobjects a LEFT JOIN  db_tank.dbo.sysindexes b
ON( a.id=b.id ) WHERE  a.type='u'  ORDER BY b.rows DESC

SELECT name,max(rows) FROM #Temp1 GROUP BY NAME ORDER BY max(rows) DESC

DROP TABLE #Temp1

你可能感兴趣的:(sql server 2005)