SELECT ROWS
FROM sysindexes
WHERE id=OBJECT_ID( 'InboundPlan')
AND indid <2
--查询库内各表
select so.name as 'TableName', so.type,SUM(row_count) as 'TotalRows'
from sys.dm_db_partition_stats as ps inner join sys.objects as so
on ps.object_id=so.object_id
where index_id<=1 and so.type='U'
group by so.name,so.type
order by sum(row_count) desc
除COUNT(*)外,上面就是查询表自己知道的最快的方法了,记录一下。
补充一个
---查询整个实例的数据库容量
SP_HELPDB