from sysobjects a
inner join sysindexes b on a.id = b.id
where a.type = 'u'
and b.indid in (0, 1)
order by a.name
SELECT o.name AS "Table Name", i.rowcnt AS "Row Count"
FROM sysobjects o, sysindexes i
WHERE i.id = o.id
AND i.indid IN(0,1)
AND o.xtype = 'u' --只統計用戶表
AND o.name <> 'sysdiagrams'
ORDER BY i.rowcnt DESC --按行排降序
COMPUTE SUM(i.rowcnt), count(o.name); --彙總行數,表數
GO